Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: gmanandge on August 03, 2010, 06:37:05 pm

Title: Beginner (very) needs help
Post by: gmanandge on August 03, 2010, 06:37:05 pm
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!




Title: Re: Beginner (very) needs help
Post by: Jenna on August 03, 2010, 06:47:43 pm
Absolutely unrelated to C::B and therefore violating our forum rules.

Topic locked !