monifa
Uploaded by
5 SLIDES
213 VUES
60LIKES

Hello World

DESCRIPTION

This tutorial dives into the essentials of C++ programming starting with the classic "Hello World!" example. It covers the basic syntax, the role of the `iostream` library for input-output operations, and explains the `main` function necessary for all C++ programs. You will also learn how to manipulate strings and perform basic operations, such as printing and modifying string content. This guide is perfect for beginners looking to understand the fundamentals of C++ coding.

1 / 5

Download Presentation
Télécharger la présentation

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
SlideServe
Audio
Live Player
Audio Wave
Play slide audio to activate visualizer