DEV Community

Kerimova_Manzura
Kerimova_Manzura

Posted on • Edited on

C++ Programming โ€“ Lesson 1: Introduction and First Program

๐Ÿ”น What is C++?

๐ŸŸข C++ is a powerful, fast, and flexible programming language widely used in:

  • System software (e.g. operating systems)
  • Game development
  • Desktop applications
  • Embedded systems

It is based on the C language, but with added support for object-oriented programming.


๐Ÿ› ๏ธ Basic Structure of a C++ Program

Letโ€™s start with the most basic program โ€” printing โ€œHello, World!โ€:

#include <iostream>
using namespace std;

int main() {
    cout << "Hello, World!" << endl;
    return 0;
}
Enter fullscreen mode Exit fullscreen mode

๐Ÿงฉ Code Explanation

Part Meaning
#include <iostream> Includes the input/output library (cin, cout, etc.)
using namespace std; Allows writing cout instead of std::cout
int main() Entry point of every C++ program
cout << "..." << endl; Prints text to the console (endl adds a newline)
return 0; Ends the program and returns 0 to the operating system (success signal)

โœ… Output:

Hello, World!
Enter fullscreen mode Exit fullscreen mode

๐Ÿง  Important Notes:

  • Every C++ program starts from main()
  • Statements must end with a semicolon ;
  • cout is used to output text to the screen

๐Ÿ”œ Coming Up Next:

  • Variables and Data Types (int, string, float, etc.)
  • Conditional Statements (if, else)
  • Loops (for, while)
  • Functions
  • Introduction to OOP (Object-Oriented Programming)

Top comments (0)