can anyone make a code in which we have to type three words and the middle word is printed | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

can anyone make a code in which we have to type three words and the middle word is printed

for ex if we type sachin ramesh tendulkar, then ramesh will appear on the output screen

7th Feb 2017, 1:31 PM
Ayush Tiwari
Ayush Tiwari - avatar
2 Answers
+ 1
set a loop from starting to the first space and find the position of first space and then set the loop in reverse order to find position of second space. while knowing both address set a loop to print all letters in between.
9th Feb 2017, 3:16 AM
धुंआधार • दुनियादार • व्यापार
धुंआधार • दुनियादार • व्यापार - avatar
0
sure... just keep an eye on the blank spaces.. make that a loop checks character by character... after the first block of consecutive non-blank spaces u will find a blank space.. (or 2.. or more) then copy to a string the next chain of non-blank space characters... by the way, that is the case when the user types all words separated by blank spaces.... But you can ask them to type one word at a time and save that word to each string type variable... you will only print the information on the second variable.. note: sorry about my bad English, it isn't my native language but i tried my best..
7th Feb 2017, 2:02 PM
xyz xyz
xyz xyz - avatar