News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

Beginner (very) needs help

Started by gmanandge, August 03, 2010, 06:37:05 PM

Previous topic - Next topic

gmanandge

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!





Jenna

Absolutely unrelated to C::B and therefore violating our forum rules.

Topic locked !