Author Topic: Beginner (very) needs help  (Read 2582 times)

gmanandge

  • Guest
Beginner (very) needs help
« 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!





Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Beginner (very) needs help
« Reply #1 on: August 03, 2010, 06:47:43 pm »
Absolutely unrelated to C::B and therefore violating our forum rules.

Topic locked !