Need some Visual C++ Express help. AND some C++ help.
8 posts
• Page 1 of 1
Need some Visual C++ Express help. AND some C++ help.
At school we were learning come C++ but with the old Visual 6 or something and from some old book. Can someone tell me how to properly setup a program using Visual C++ express? And in my code its iostream.h. But I heard the .h is out dated and dont know what to change it to. And I cant even excute this in Visual. And this is in a Source.cpp.
- Code: Select all
#include <iostream>
main()
{
int number_of_people;
int share;
int remainder;
cout << "How many people are there?";
cin >> number_of_people;
share= number_of_people / 50;
cout << "You need this many buses " << share << '\n';
remainder= number_of_people % 50;
cout << "You have this many people left over " << remainder << '\n';
return 0;
}
- xxsonyboy4lfexx
- Posts: 315
- Joined: Sat Jan 07, 2006 4:42 pm
- Location: California
I'm not sure of this because I haven't worked with VisualC++ but I think that you must import conio.h to use the cin and cout functions. If the extension .h doesn't work you can try to import .c files (iostream.c and conio.c) - I could be wrong but I think the imports should look like this :
- Code: Select all
#include <conio>
#include <iostream>
Good luck!
Best wishes,
John!
I don't see any compiles but I did all the builds that I could choose and I continue to get the same error.
- xxsonyboy4lfexx
- Posts: 315
- Joined: Sat Jan 07, 2006 4:42 pm
- Location: California
I tried doing another new project and opening the source file a different way. And I get the same error but I also noticed this one when it failed the build
c:\documents and settings\andrew\desktop\andrew\files\coding\test\test\test.cpp(1) : fatal error C1083: Cannot open include file: 'conio': No such file or directory
c:\documents and settings\andrew\desktop\andrew\files\coding\test\test\test.cpp(1) : fatal error C1083: Cannot open include file: 'conio': No such file or directory
- xxsonyboy4lfexx
- Posts: 315
- Joined: Sat Jan 07, 2006 4:42 pm
- Location: California
That means it cannot find the library files for the functions you're using (cin, cout etc). This can appear if the compiling directories haven't been set (which means the compiler doesn't know where to look for iostream.h and conio.h)
You should check the Options (or Preferences menu) for the compiler directories. You should also search the files iostream.h and conio.h to see what is the location of those two on your computer.
You should check the Options (or Preferences menu) for the compiler directories. You should also search the files iostream.h and conio.h to see what is the location of those two on your computer.
8 posts
• Page 1 of 1
Return to HTML, CSS, and Scripts
Who is online
Users browsing this forum: No registered users and 4 guests