Sign in to follow this  
DRAGONmax

When,How,and Why(#include?)

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
You'll also be creating header files of your own. Once you learn functions and linkage, you'll understand these things.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this