compiler always fails..

im using Microsoft visuals express 2010.and no matter that i try i always get a unable to start program or errors in build..

honestly i just started today so anything would help...

----------------------------------------------------------

// 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;
}

---------------------------------------------
said was was a success.. but unable to start..
I don't know about visual express, but I use visual studio and I need #include "stdafx.h" in order to make it run. Try putting that at the top and see if that helps.
No. NO. Never ever include stdax.h - it causes way more problems than it solves. If your project requires it you chose the most incorrect project type you could choose.

Your code is fine: http://ideone.com/2FDme
maybe microsoft likes #include "stdafx.h"...
i read the error report and it suggested it...

but i did the next section and it worked as written on the tutorial... :(
is there a better program then visual 2010?
Start with a fresh project but make sure you choose blank, empty, "don't use precompiled headers", etc. whenever you see the option to. Otherwise it will make you go through this trouble...
yea thats what i was doing.. least i think so.. gonna try again in a little taking a break lol.
ill let u know how it goes.
Topic archived. No new replies allowed.