English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Here is my code it work in my other IDE BUT NOT IN VISUAL why THE PRECOMPILE HEADER IS TURN OFF. EVEN WITH TURN ON IT DIDN'T WORK

2006-10-30 13:20:04 · 2 answers · asked by Best Helper 4 in Computers & Internet Programming & Design

#include


int main()
{
int a;
int my;
my = 15;

cout << "What do u think My age is?: ";
cin >> a;

if(a == my)
{
cout << "U have Guessed Right.. YEA!";
cout << endl << "Congradulation";
}
else
{
if(a < my)
{
cout << "GO HIGHER" << endl;
}
else
{
cout << "TOO HIGH..Go LOWER" << endl;
}
}
main();
return 0;
}

2006-10-30 13:20:31 · update #1

1>------ Build started: Project: 2_if_1_else, Configuration: Debug Win32 ------
1>Compiling...
1>2_if_1_else.cpp
1>c:\documents and settings\gagandeep\my documents\visual studio 2005\projects\2_if_1_else\2_if_1_else\2_if_1_else.cpp(10) : error C2065: 'cout' : undeclared identifier
1>c:\documents and settings\gagandeep\my documents\visual studio 2005\projects\2_if_1_else\2_if_1_else\2_if_1_else.cpp(11) : error C2065: 'cin' : undeclared identifier
1>c:\documents and settings\gagandeep\my documents\visual studio 2005\projects\2_if_1_else\2_if_1_else\2_if_1_else.cpp(16) : error C2065: 'endl' : undeclared identifier
1>Build log was saved at "file://c:\Documents and Settings\Gagandeep\My Documents\Visual Studio 2005\Projects\2_if_1_else\2_if_1_else\Debug\BuildLog.htm"
1>2_if_1_else - 3 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

2006-10-30 13:20:43 · update #2

thanks for the help the 1 person

I got this error when I build it MSVCP80D.dll
not found do i have to reinstall it.

2006-10-30 14:00:20 · update #3

2 answers

Step 1) RELAX bro, in programming its bad to get fustrated, if you are take a break or something.

You forgot to use the line "using namespace std;" so either you need to use the namespace std, or you need to use the std class and the scope resoultion operator ( :: ) whenever you use cout...example

std::cout << "This is how you use it";

#include

using namespace std;

int main()
{
int a;
int my;
my = 15;

cout << "What do u think My age is?: ";
cin >> a;

if(a == my)
{
cout << "U have Guessed Right.. YEA!";
cout << endl << "Congradulation";
}
else
{
if(a < my)
{
cout << "GO HIGHER" << endl;
}
else
{
cout << "TOO HIGH..Go LOWER" << endl;
}
}
main();
return 0;
}

2006-10-30 13:52:30 · answer #1 · answered by D 4 · 0 0

You need this:

#include
using namespace std; // additional string.

It is very suspicious that your compiler does not catch such things: namespace is strongly required here.

2006-10-30 22:38:50 · answer #2 · answered by alakit013 5 · 0 0

fedest.com, questions and answers