+ 1

How to take space-separated value input in C++?

17th Nov 2022, 2:33 PM
Saurabh Shukla
Saurabh Shukla - avatar
12 Réponses
+ 5
If you need help with your own code, link it so we can see what you tried. Without seeing what you did, we can't tell you what's wrong
17th Nov 2022, 3:02 PM
Lisa
Lisa - avatar
17th Nov 2022, 2:54 PM
Sakshi [Offline 🙃]
Sakshi [Offline 🙃] - avatar
+ 4
in c++ by default when you get input with cin, it will start reading user input till meet a space or new line. So the answer is just use cin for every value you need to get. I suggest you learn more on "c++ streams"
17th Nov 2022, 4:05 PM
Giannis
Giannis - avatar
+ 3
You can get the input as string and then split the string at the separator into an array.
17th Nov 2022, 2:53 PM
Lisa
Lisa - avatar
+ 1
I have already checked, I did not get the result I wanted.
17th Nov 2022, 3:00 PM
Saurabh Shukla
Saurabh Shukla - avatar
+ 1
I have already checked ,idid not get the results I wanted.
19th Nov 2022, 5:27 AM
Shaik rizwana
Shaik rizwana - avatar
+ 1
If you want to take a space between two values the use endl Eg cout << "blabla" << endl;
19th Nov 2022, 12:49 PM
Sourabh Jaiswal
Sourabh Jaiswal - avatar
0
Bhai log answer answer aa gya Thanks everyone for helping.
19th Nov 2022, 5:33 AM
Saurabh Shukla
Saurabh Shukla - avatar
0
Oooo
19th Nov 2022, 5:34 AM
Shaik rizwana
Shaik rizwana - avatar
0
Aacha
19th Nov 2022, 5:34 AM
Shaik rizwana
Shaik rizwana - avatar
0
bhai endl ke jagah ends use kerte hai!
19th Nov 2022, 12:56 PM
Saurabh Shukla
Saurabh Shukla - avatar
0
Nahi bro ends se ek hi line me code output dikhaiga endl se tu dho statement ko alag kerskta hea Eg cout << "hdhdusis" <<endl; cout <<"HDHDHS"; OUTPUT: hdhdusis HDHDHS aiga verna ese aiga hdhdusiHDHDHS
20th Nov 2022, 11:07 AM
Sourabh Jaiswal
Sourabh Jaiswal - avatar