+ 4

What to type when asked to split multiple inputs into separate lines

28th Oct 2016, 12:59 AM
Akosuah Nsafoah
Akosuah Nsafoah - avatar
2 Réponses
+ 4
That varies from code to code. You must know the no. of Inputs the program will require beforehand. Depending on the no. of inputs required you have split them in equal no. of lines. for e.g. .. .. .. int a; cin>>a; cout<<a; int b; cin>>b; cout<<b; int c; cin>>c; cout<<c; return 0; } The given code snippet has three inputs. So you must split the inputs into 3 lines while running like 2 4 6 The value is assigned in the same order. So , after running a=2 b=4 c=6
28th Oct 2016, 10:34 AM
Anbu Coder
Anbu Coder - avatar
+ 1
You write in the inputs you want the user to enter. So imagine you are the user, and you're entering in the numbers that is wanted in the code. If its a while loop and its wanting 10 numbers, enter 10 numbers like this: 1 2 3 4 5 6 7 8 9 10 and then press "Enter" to run the code with those numbers.
21st Nov 2016, 12:54 AM
Blake Bullen
Blake Bullen - avatar