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

cpp_basic_notes

c++

Uploaded by

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

cpp_basic_notes

c++

Uploaded by

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

C++ Basic Notes

Introduction to C++
C++ is a general-purpose programming language created by Bjarne Stroustrup as an extension of
the C programming language. It supports both procedural and object-oriented programming,
making it versatile for various applications.

Basic Structure of a C++ Program


A basic C++ program consists of: 1. Preprocessor directives (#include) 2. Namespace declaration
3. main() function 4. Statements and expressions 5. Return statement

Data Types
• int - Integer numbers
• float - Floating point numbers
• double - Double-precision floating point numbers
• char - Single characters
• string - Sequence of characters
• bool - Boolean values (true/false)

Variables and Constants


Variables are used to store data. They must be declared before use. Constants are fixed values
that cannot be changed.

Operators
• Arithmetic: +, -, *, /, %
• Relational: ==, !=, >, <, >=, <=
• Logical: &&, ||, !
• Assignment: =, +=, -=, *=, /=
• Increment/Decrement: ++, --

Control Structures
• if, if-else, nested if
• switch-case
• for loop
• while loop
• do-while loop

Functions
Functions are blocks of code that perform a specific task. They help in code reusability and better
organization.

Object-Oriented Programming Concepts


• Class and Object
• Encapsulation
• Inheritance
• Polymorphism
• Abstraction

You might also like