Which value takes "i" in code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Which value takes "i" in code?

In line #9 in the code when I entered a line of numbers (cin>>n) what is a value of i (i=n). I mean which number from the line I entered does "i" equal or it takes the whole line of numbers https://code.sololearn.com/cv81n3Sgaw47/?ref=app

10th Jan 2018, 12:45 PM
Yura Tarasov
Yura Tarasov - avatar
2 Answers
+ 9
Blackcat1111 is correct about cin, but... Since n is an integer datatype, it will only ever accept one number anyway. To store more than one number you will want to look into arrays, or you could use a string and getline. But using an array would be easier and more appropriate for this application.
10th Jan 2018, 1:21 PM
jay
jay - avatar
+ 4
It should take the first number as cin stops at the first space (I think).
10th Jan 2018, 1:01 PM
blackcat1111
blackcat1111 - avatar