Hi all..it's me =)
Help me please...
This code can be build and run in codeblocks..
But when i went to VS2010, no matter how i try, it is not working.
Can anyone tell me what is wrong with the codes or what is wrong with this vs2010?
#include <iostream>
#include "StdAfx.h"
int main()
{
int x,y,z;
for (x=1; x<=3; x++)
{
for (y=1; y<3; y++)
{
if (y == 2)
break;
for (z=1; z<3; z++)
{
std::cout << x << " " << y;
std::cout << " " << z << std::endl;
}
}
}
return 0;
}
====
Hello.cpp(1): warning C4627: '#include <iostream>': skipped when looking for precompiled header use
Add directive to 'StdAfx.h' or rebuild precompiled header
Hello.cpp(18): error C2039: 'cout' : is not a member of 'std'
Hello.cpp(18): error C2065: 'cout' : undeclared identifier
Hello.cpp(19): error C2039: 'cout' : is not a member of 'std'
Hello.cpp(19): error C2065: 'cout' : undeclared identifier
Hello.cpp(19): error C2039: 'endl' : is not a member of 'std'
Hello.cpp(19): error C2065: 'endl' : undeclared identifier
You're starting a new project incorrectly. You mistakenly started a "New Console Project". This is not a good idea because it causes more issues than a "Blank Project".
Start a "Blank Project" (you may have to change which tree you are viewing on the left) and then right click the "Source Files" on the left and click "Add" -> "New Item" and add a .cpp file (you can name it anything).
Then you can start your program in there. Just this code will do: