0% found this document useful (0 votes)
1 views5 pages

Introduction to c++ Programming

C++ is a general-purpose programming language developed by Bjarne Stroustrup in the early 1980s, extending C with object-oriented features. It is compiled, strongly typed, and efficient, commonly used in various domains including software and game development. The document outlines the basic structure of a C++ program, common errors to avoid, and provides an example of a simple program that displays a name.

Uploaded by

Charles Ghati
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views5 pages

Introduction to c++ Programming

C++ is a general-purpose programming language developed by Bjarne Stroustrup in the early 1980s, extending C with object-oriented features. It is compiled, strongly typed, and efficient, commonly used in various domains including software and game development. The document outlines the basic structure of a C++ program, common errors to avoid, and provides an example of a simple program that displays a name.

Uploaded by

Charles Ghati
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 5

INTRODUCTION TO

C++ PROGRAMMING
• 1. What is C++?
• - C++ is a general-purpose programming language.
• - It was developed by Bjarne Stroustrup in the early 1980s.
• - C++ is an extension of the C language, adding object-oriented features.
• - It is used for system/software development, game programming, embedded
systems, and more.

• 2. Key Features of C++


• - Compiled language: Must be translated into machine code before
running.
• - Object-Oriented: Supports classes and objects.
• - Strongly typed: Variables must be declared with a type.
• - Fast and efficient.
3. Basic Structure of a C++ Program
#include <iostream> // Preprocessor directive

using namespace std; // Allows use of standard names

int main() { // Main function - entry point


cout << "Hello, World!"; // Output statement
return 0; // End of program
}

4. Explanation of Components
- #include <iostream> – Includes input/output stream library.
- using namespace std; – Allows the use of cout and cin without std:: prefix.
- int main() – Starting point of the program.
- cout – Used to display output on the screen.
- return 0; – Ends the program.
5. Writing and Running a C++ Program
- Use a text editor or an IDE (e.g., Code::Blocks, Dev-C++, Visual Studio).
- Save the file with a .cpp extension.
- Compile using a compiler (e.g., g++).
- Run the compiled executable file.

6. Common Errors to Avoid


- Missing semicolons ;.
- Misspelled keywords like main, return.
- Forgetting to include #include <iostream>.
7. First Task Example

*Write a C++ program that displays your name:*

#include <iostream>
using namespace std;

int main() {
cout << "My name is Charles Ghati";
return 0;
}

You might also like