1 / 5

Hello World

Hello World. #include < iostream > using namespace std; int main () { cout << "Hello World!"; return 0; }. #include < iostream > This specific file ( iostream ) includes the declarations of the basic standard input-output library in C++. using namespace std;

monifa
Download Presentation

Hello World

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Hello World #include <iostream> using namespace std; int main () { cout << "Hello World!"; return 0; }

  2. #include <iostream> • This specific file (iostream) includes the declarations of the basic standard input-output library in C++. • using namespace std; • All the elements of the standard C++ library are declared within what is called a namespace. • int main () • it is essential that all C++ programs have a main function • { • cout << "Hello World!"; • cout (and cin) represents the standard output stream in C++, • return 0; • }

  3. // my second program in C++ #include <iostream> using namespace std; int main () { cout << "Hello World! "; cout << "I'm a C++ program"; return 0; }

  4. // my first string #include <iostream> #include <string> using namespace std; int main () { string mystring; mystring = "This is the initial string content"; cout << mystring << endl; mystring = "This is a different string content"; cout << mystring << endl; return 0; }

  5. endl // endl #include <iostream> usingnamespace std; int main () { int a=100; double b=3.14; cout << a; cout << endl; // manipulator inserted alone (adds newline) cout << b << endl << a*b; // manipulator in concatenated insertion return 0; }

More Related