0

One line user input...

How to get multiple input as variable and make sum... if I use array then I have to declare array length but I want to make program that user can input 2 values next time 3 values or 4,5 values to make sum, I don't know when and how much value going to be input... Can I do it??? Please help...

27th Jun 2020, 7:06 AM
Aminul
Aminul - avatar
3 odpowiedzi
0
You can do cascading for multiple inputs i.e, multiple cin.
27th Jun 2020, 7:17 AM
123
0
If I use multiple cin then I have to declare all value part by part or use array...I already said that I don't know array length...I hear about vector lib but I don't know how to use...
27th Jun 2020, 7:35 AM
Aminul
Aminul - avatar
0
First, input a n of numbers you want to sum. Then input your numbers Example: 3 4 5 1 3 is n, 4, 5, and 1 is your number Output is 10 https://code.sololearn.com/cRtKoQ9ozVbG/?ref=app
27th Jun 2020, 7:48 AM
RpixPro
RpixPro - avatar