Question:
I need to have 'cstdlib.h' for my C++ program to work (this is from a book), where can i find it?
2006-10-24 17:26:51 UTC
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 << "Please type your name and hit Enter: ";
cin >> yourname;

cout << endl << "Hello, " << yourname << endl << endl;

cout << "Press c and hit Enter to continue...";

char justwait;
cin >> justwait;

return 0;
}

Any help would be greatly appreciated.
Nine answers:
Mark aka jack573
2006-10-28 12:16:49 UTC
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.
2016-09-01 06:12:02 UTC
I severely doubt if any pc books are available languages instead of English, exceptionally the language books. The best 2 books I have referred in my lifestyles are "Let us C" via Yashwant Kanitkar. This is the publication, to begin if you happen to obviously dont have any inspiration approximately what's C. The moment publication is Kernigham, ritchi. This is a need to if you happen to wish to move deep and get all of your fundaes transparent. I will say earlier than going to any C interview, have a appear at this publication. Learning time will depend on your greedy potential, and curiosity in area, and in addition what you wish to do. If you simply wish to put in writing packages with out figuring out what occurs within compiler, studying the complete C language, shall be topic of weeks. But if you happen to wish to get truly champion, it may be topic of years. I am studying C from final 6 years.
alakit013
2006-10-24 18:57:23 UTC
In C++, according to the ned standard,

#include

(without ".h"!!!) - is just a replacement for C-style

#include

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.
arbeit
2006-10-24 17:57:20 UTC
Don't use quotes, use <>. That is, try



#include

#include



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.
hutt
2016-12-18 23:06:52 UTC
Stdlib.h Download
dws7011
2006-10-24 20:55:31 UTC
if

#include

#include

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)
n0body
2006-10-24 18:48:01 UTC
You don't need .h

Just

#include
Hawk
2006-10-24 18:47:03 UTC
do not use stdlib.h

use

cuz u r using strings
lostinlife
2006-10-24 18:06:17 UTC
go to this link :





http://www.koders.com/c/fid3A900BAE5C83929336E0AEE9CFDF192AE82E679F.aspx


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...