compiling problem

i m tyring to compiling the program of variables but it shows some errors and i have written everything same as the input of variables on this site what should i do can any1 help me please.
below is the input which i used for programming and in which i m encountering problem plz help me...

input:-

// operating with variables

#include <iostream>
using namespace std;

int main ()
{
// declaring variables:
int a, b;
int result;

// process:
a = 5;
b = 2;
a = a + 1;
result = a - b;

// print out the result:
cout << result;

// terminate the program:
return 0;
}

please help me regarding this
what does the error message display?
Perhaps you're having the same issue as described in this thread? http://www.cplusplus.com/forum/beginner/44202/
closed account (zb0S216C)
Your error definitely doesn't reside in the code you posted.

What IDE are you using? and what error message( s ) are you receiving?

Wazzak
I literally copied and pasted this based on what you posted:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <iostream>
using namespace std;

int main ()
{
// declaring variables:
int a, b;
int result;

// process:
a = 5;
b = 2;
a = a + 1;
result = a - b;

// print out the result:
cout << result;

// terminate the program:
return 0;
}


I didn't modify anything, and the code ran fine for me. As shekhartanwar mentioned, could you please share your error message with us?
Last edited on
closed account (zb0S216C)
Based on Zero One's experience, it's more than likely it's the common Stdafx error. You can disable the Stdafx header. Simply follow my instructions below.

Instructions:
1) Open your project options
2) Under the C/C++ node, select: Precompiled Headers
3) In the first field, choose the option: Not Using Precompiled Headers.


Make sure you do the same for both Debug and Release versions.

Wazzak
Last edited on
Topic archived. No new replies allowed.