vse2012 - cout is undefined

Jan 24, 2013 at 4:28am
Hi there, I've run into a strange error using vse2012 to run some simple c++ code and I'm hoping someone here can help. This is pretty weird, at least to me, so bear with me. (some of the headers may be unnecessary for this particular source, i left them in since i'm following along with a book and i'm honestly not sure which ones i need and don't need at this point, sorry about that.)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <iostream>
#include <cmath>
#include <ctime>
#include <cstdlib>

int main(){
	int  ar [6]= {10, 22, 13, 99, 4, 5};
	int x, i;
	for (i=0; i<=5; i++){
		cout<<ar[i];
		cout<<x+i;
	}
	system("PAUSE");
	return 0;
}


on line 10, i get an intellisense error: "Identifier "cout" is undefined", yet on line 11, cout does not generate an error. this is utterly baffling to me. i'm using a fresh install of visual studio express 2012 desktop on win7 x64.

thanks for your suggestions!
Jan 24, 2013 at 4:29am
std::cout
Jan 24, 2013 at 4:49am
Or you can add using namespace std; after including header files..
Jan 24, 2013 at 5:43am
@staticwarp

You should also initialize x to zero or some other number before trying to use it in the loop.
Jan 24, 2013 at 9:51pm
thanks for the help, i should have noticed that using namespace std was missing. initializing x was also necessary - thanks for pointing it out!
Topic archived. No new replies allowed.