reading number b/w 2 inputs?

Im trying to make a program where i want it to output the numbers between two input values. im using while statements and the condition is that the 1st number entered is < the second number entered. (num1 < num2)

say the user inputs 3 and 10 (num1 = 3 and num2 = 10. I need the program to display the numbers in between those numbers. ie. 4,5,6,7,8,9.

how does c++ decipher what numbers are between num1 and num2?

cheers guys!
for (; num1 < num2; ++num1) cout << num1 << endl
hi i am not sure what the about code does, so i dont want to put it in my code yet.

i have been searching around as i am finding it difficult there was a post awhile back for pretty much the same question and the code was:

1
2
3
4
5
6
7
8
int i[2], s=0;
cin >> i[0] >> i[1];
while ( i[0]<=i[1])
{
      s+=i[0];
      i[0]++;
}
cout << '\n' << s;


see where the declared variable has 'int i [2]' what does this give i? i havnt seen square brackets after a variable. if i have i tihnk it was an array.

cheers
also can anyone tell me what s is?

btw this is an archived thread:

http://www.cplusplus.com/forum/beginner/5216/
Topic archived. No new replies allowed.