I have just started and am using a tutorial from cplusplus.com to teach myself very basic C++ programming. The first program was pretty easy and pretty easy to modify; it ran without issues. I copied the second program exactly as it appears in the tutorial but it would not run and looks like this:
//Operating with variables
#include <iostream>
using namespace std;
int main ()
{
//declaring variables
int a, b;
//process or operation/algorithm
a = 5;
b = 2;
a = a + 1;
result = a - b;
//print out the result:
cout << result;
//end the program
return 0;
}
When I run it, line 12 shows:
error: 'result' was not declared in this scope
I'm not sure what this means and how would I fix it? Any help is greatly appreciated. Thanks!