Hey all,
I know this is a very newbish questions, but I couldn't readily find the answer on this board so I figured I would ask.
Consider the following code snippet:
for(i=0;i<5;i++)
{
int number;
int counter;
cout << "Enter a number less than 10:"
<< endl;
cin >> number;
counter = number;
while(number < 10)
{
number ++;
cout << number << " and " << counter << endl;
}
}
Now lets assume that the value of number changes within the while loop (as it does above): will the value of counter automatically change as well? If it does, what is the best way to create a variable that will hold the original value of number for one loop and then at the start of the next loop, take on the new value of number?
Again, I know this is probably a very simple question, but any help would be greatly appreciated.
-D