And in case anyone was going to say this, I tried using stdlib.h and ctdlib.h.
Here is my code:
#include "stdlib.h"
#include "iostream.h"
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
string yourname;
cout %26lt;%26lt; "Please type your name and hit Enter: ";
cin %26gt;%26gt; yourname;
cout %26lt;%26lt; endl %26lt;%26lt; "Hello, " %26lt;%26lt; yourname %26lt;%26lt; endl %26lt;%26lt; endl;
cout %26lt;%26lt; "Press c and hit Enter to continue...";
char justwait;
cin %26gt;%26gt; justwait;
return 0;
}
Any help would be greatly appreciated.
I need to have 'cstdlib.h' for my C++ program to work (this is from a book), where can i find it?
The file you are after should be in the folder named 'include' that is part of the Visual C++ Express Edition (compiler). I personally do not use this. I would point you in the direction of where the compiler is installed in your system. For instance, it could be in your 'program files' folder. You should not have to download it.
Another point is, as you book says, you should use 'cstdlib.h', but this [edit] 'cstdlib.h' [end edit] may refer to 'stdlib.h' so you are best off checking both files.
If you cannot find these, you may have to do a search for the files. You can usually find the search option when you open the 'start' menu.
Reply:You don't need .h
Just
#include %26lt;cstdlib%26gt;
Reply:go to this link :
http://www.koders.com/c/fid3A900BAE5C839...
Reply:if
#include %26lt;cstdlib%26gt;
#include %26lt;iostream%26gt;
using namespace std;
doesn't work, you'll need to reinstall your compiler because simply installing the .h file won't work, you'll need the libraries (.o's associated with the files)
Reply:In C++, according to the ned standard,
#include %26lt;cstdlib%26gt;
(without ".h"!!!) - is just a replacement for C-style
#include %26lt;stdlib.h%26gt;
prefix 'c' means that this include file is inherited from good old plain C. In either case, you can use old, C style for headers files: it is not an error.
When to use double quotes and when to use angle brackets -- read preprocessor manual. For standard files (or others, placed at Include path), you always need angle brackets. Double quotes mean search in the project directory.
Reply:do not use stdlib.h
use %26lt;string.h%26gt;
cuz u r using strings
Reply:Don't use quotes, use %26lt;%26gt;. That is, try
#include %26lt;stdlib.h%26gt;
#include %26lt;iostream.h%26gt;
The angle brackets tell the preprocessor to look for the header file in the system header directories, which is what you want.
If you use quotes, you're telling the preprocessor that you want to load your own header file, probably located in the same place as your .C file. This is not what you want here.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment