How to take input just separated by one space ?[NOT FOR SOLOLEARN COMPILER] | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to take input just separated by one space ?[NOT FOR SOLOLEARN COMPILER]

https://code.sololearn.com/c4EIYv8s2hvx/?ref=app In the problem question was asked to input one pair of integers per line and those number should be separated by space. For example: if you are about input two number let assume 4 and 5 you must enter it like: 4 5 You are not allowed to hit enter after entering one number, it must separated by space. my question: is there any specific methods to input anything just separated by space ? Or it works fine without doing anything ? Because i am using CodeBlocks IDE and it just works fine for both space and enter without doing anything. Is it works for all IDE, Platform or anywhere ?

7th Apr 2020, 4:35 AM
Kuber Acharya
Kuber Acharya - avatar
3 Answers
+ 1
I'm working on Visual Studio. For this: Get input from user using getline function. And store this input into a character array. After input run a while loop until c != '\n' And copy values to other arrays. On whitespace. You can define what do you want to do..
7th Apr 2020, 5:06 AM
C ++
C ++ - avatar
0
No. We have to define this process.
7th Apr 2020, 5:01 AM
C ++
C ++ - avatar
0
C ++ okay! I will try:) Thanks
7th Apr 2020, 11:21 AM
Kuber Acharya
Kuber Acharya - avatar