Hello everyone,
I'm studying the while statement now, and there is an example code and I tried to make it and see what it does. When I wanted to start it said it has errors and when I started with debugging I get a weird statement on my cmd program.
The code:
// While statement program
#include <iostream>
int main()
{
int sum = 0, val = 1;
while (val <= 10) {
sum += val;
++= val;
}
std::cout << "The sum of 1 to 10 inclusive is" << sum << std::endl;
return 0;
}
What have I done wrong? There are also some screenschots of Visual Studio* and the CMD in the attachments.
Kareem
- Visual Studio 2012 Ultimate