Tuesday, June 23, 2009

A new way to include libraries



NOTE : -
THIS CONTENT IS NOT ORIGINAL

1. A new way to include libraries

There is a new way to #include libraries (the old method still works yet the compiler complains). The .h extension is not used any more, and the names of standard C libraries are written beginning with a c. In order for the program to use these libraries correctly using namespace std; has to be added:


using namespace std;
#include // This is a key C++ library
#include // The standard C library math.h

int main ()
{
double a;

a = 1.2;
a = sin (a);

cout << a << endl;

return 0;
}


Output
0.932039



A few hints for beginners:

To compile this program, type it (or copy & paste it) into a text editor (gedit, kwrite, kate, kedit, vi, emacs, nano, pico, mcedit, Notepad...), save it as a file named, say
test01.cpp (if you are a newbie, best put this file inside your home directory, that is, for example /home/jones on a Unix-like box).

To compile the source code file, type this command (on most open-source Unix-like boxes) in a console or terminal window:

g++ test01.cpp -o test01

To run the binary executable file
test01 that has been produced by the compilation (assuming there were no errors), type this:

./test01

Each time you modify the test01.cpp source code file, you need to compile it again if you want the modifications to be reflected in the test01 executable file (type the up-arrow key on your keyboard to recall commands).



BIBILOGRAPHY / REFERENCE : - http://www.4p8.com/eric.brasseur/cppcen.html

No comments:

3G S

JAIL BREAK

iPHONE

BILL GATES

StEvE JoBs

steve jobs

STEVE JOBS

Steve Jobs

Love Country

SD

Burroughs

Lift

Joseph Johnson

Apple Rainbow

Apple Blue

Apple Laser Printer