Jump to content

Featured Replies

Posted

I just started using Visual C++ 2005 and the whole program is extremely foreign to me (I'm used to using Borland) and I have already run into problems, I keep on getting build errors with a program that realistically should work.

 

This is the build output

 

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

 

and this is the code I am trying to compile

 

#include <iostream>
#include <conio.h>
#include <stdio.h>



int main()
{
cout <<"What number do you want to use?"<<endl;
int mynum;
cin >>mynum;

mynum = mynum * 2;

cout <<"The answer is "<<mynum<<endl;

return 0;
}

 

Very simple stuff but it has stumped me, anybody willing to help?

AGYAGHAHAHHAHAHAHAHHAHAHAHJHAHAHAHHAHAHAHAGHGAHAHAHAHAHHAHAHAHAHAHAHHAHAHAHAJHAHHAJHAHAH

 

AHAHA THANK YOU, THANK YOU FOR MAKING MY NIGHT!

#include <iostream>
#include <conio.h>
#include <stdio.h>



int main()
{
cout <<"What number do you want to use?"<<endl;
int mynum;
cin >>mynum;

mynum = mynum * 2;

cout <<"The answer is "<<mynum<<endl;

return 0;
}

 

that dont make sense!

 

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

 

post this lesson please then you wil get better help :)

  • Author

post this lesson please then you wil get better help :)

 

The lesson is at http://forum.gamedeception.net/showthread.php?t=1222

 

I know alot of the stuff in this lesson already (I know pretty much all the basics except pointers) but I'm still going through it as a review and have already been stumped by not the code but the compiler. :thinker:

I just started using Visual C++ 2005 and the whole program is extremely foreign to me (I'm used to using Borland) and I have already run into problems, I keep on getting build errors with a program that realistically should work.

 

 

 

and this is the code I am trying to compile

 

#include <iostream>
#include <conio.h>
#include <stdio.h>



int main()
{
cout <<"What number do you want to use?"<<endl;
int mynum;
cin >>mynum;

mynum = mynum * 2;

cout <<"The answer is "<<mynum<<endl;

return 0;
}

 

Very simple stuff but it has stumped me, anybody willing to help?

 

try this...

 

#include<iostream>
using namespace std;
int main(){
int mynum;
cout <<"What number do you want to use?"<<endl;
cin >>mynum;
mynum = mynum * 2;
cout <<"The answer is "<<mynum<<endl;
return 0;
}

Guest
This topic is now closed to further replies.