When,How,and Why(#include?)

Started by
4 comments, last by gohacker82 19 years, 8 months ago
Hi to all Im sure you all know im new to all this. I tryed the search but didnt see what i was looking for,so let me say im sorry if i did anything wrong by posting this. Ok when using #include< > i know(or at least i think i know), <iostream> is input output and thats a file that has the cout,and the cin info, and thats what makes you able to display things on screen,and as well as enter things into a program when prompt. And then theres <string> and thats used when you do things like (string YELL="Help me to understand"); But then theres others that you can place between< >,like (<stdlib.h>) 1.What is it for? 2.In what situation would i use it in or why would i use it? (show an example plz) 3.How many other of these things are there?is there somewhere i can get a whole list of them(That shows why and in what situation i would use them in.like this one is used for this, and this one is used for that) I have a book but all i see in it is #include<iostream> and #include<string> where can i get a list of the others and how and when to use them. P.S.I want to thank everyone out there its nice to know that there are folks like you to help stupid ones like me thanks agian
Advertisement
stdlib.h is the header for standard library functions...it has a mess of functions. Don't worry about it till you get there! There a millions of headers...You don't need to know what they are all for. When you require a special function to do something, look it up (or ask us [wink], and you will find out what include file to use.
----------------------------------------------------"Plant a tree. Remove a Bush" -A bumper sticker I saw.
i use this page. these are what are called "libraries". they can help you do basic things that people have found usefull in programming throughout the years.

stdlib: General purpose standard C library, including memory allocation, process control, conversions and others.

a lot of these came out before C++, so they aren't as easy to use, but once you get used to them they are more powerfull than iostream and string. so i would recommend them for anyone.
As your leader, I encourage you from time to time, and always in a respectful manner, to question my logic. If you're unconvinced that a particular plan of action I've decided is the wisest, tell me so, but allow me to convince you and I promise you right here and now, no subject will ever be taboo. Except, of course, the subject that was just under discussion. The price you pay for bringing up either my Chinese or American heritage as a negative is - I collect your f***ing head.
You'll also be creating header files of your own. Once you learn functions and linkage, you'll understand these things.
- A momentary maniac with casual delusions.
if you are using c++ then you would include

#include <cstdlib>

instead of
#include <stdlib.h>

with #include<>, we can combine our code with another code (usually called a header or another file).

with this concept we can be more easy to make some program.

for example:

in file data.dat

int data=10;

ok now we make the main function in main.cpp


#include<stdio.h>; //this is for the standard Input Output header. so we can use the printf("...",...) function

#include"data.dat"

int main()
{
printf("%d",data); // this is for displaying data..
return 0;
}

ok.. thats all
thanks..

--syr

This topic is closed to new replies.

Advertisement