0% found this document useful (0 votes)
7 views2 pages

CPP

C++ is a versatile programming language that extends C and supports multiple programming paradigms. The document covers the basics of C++ including syntax, variables, control structures, functions, and object-oriented programming. It concludes by highlighting C++'s relevance in various fields such as systems programming and game development.

Uploaded by

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

CPP

C++ is a versatile programming language that extends C and supports multiple programming paradigms. The document covers the basics of C++ including syntax, variables, control structures, functions, and object-oriented programming. It concludes by highlighting C++'s relevance in various fields such as systems programming and game development.

Uploaded by

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

C++ Programming Basics

Introduction
C++ is a general-purpose programming language created by Bjarne Stroustrup as an
extension of the C language. It supports procedural, object-oriented, and generic
programming features, making it one of the most widely used languages for software
development.

Getting Started
To write and run C++ code, you need a compiler such as g++ (GNU Compiler
Collection) or the compiler provided with Visual Studio.

Basic Syntax
A simple C++ program:
#include <iostream>
using namespace std;

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

Key Concepts
1. Variables and Data Types
int age = 25;
double height = 1.75;
char grade = 'A';
bool isStudent = true;

2. Control Structures
if (age > 18) {
cout << "Adult";
} else {
cout << "Minor";
}

for (int i = 0; i < 5; i++) {


cout << i << endl;
}

3. Functions
int add(int a, int b) {
return a + b;
}

4. Object-Oriented Programming
class Car {
public:
string model;
int year;
void display() {
cout << model << " - " << year << endl;
}
};

int main() {
Car car1;
car1.model = "Toyota";
car1.year = 2020;
car1.display();
return 0;
}

Conclusion
C++ remains a relevant and powerful language, suitable for systems programming,
game development, and performance-critical applications.

You might also like