SlideShare a Scribd company logo
C++ course start
Goal
Staff
Products
C++ course start
C++ course start
C++ course start
C++ course start
Contact us
01211992678 www.net3lem.com
01211992674 https://www.facebook.com/net3lem
C++ Course
Alaa Ramadan
Net3lem
History Of Programming Languages
C++ course start
C++ course start
C++ course start
C++ course start
C++ course start
C++ course start
C++ course start
// CODE
// my first program in C++
#include <iostream>
using namespace std;
int main ()
{
cout << "Hello World!" ;
return 0;
}
/////////////////OR//////////////////////////////////
int main () { cout << "Hello World!" ; return 0; }
Output
Hello World!
C++ course start
Physical Memory
Variable
a
C++ course start
C++ course start
C++ course start
C++ course start
Functions
Divide your Code
Functions
A function is a group of statements that together perform a task
C++ program has at least one function which is main(),
divide up your code into functions each function performs a specific task.
Defining a Function:
function's name,
return type,
parameters.
actual body of the function.
return_type function_name( parameter list )
{
body of the function
}
Example:
Calling a Function:
return_type function_name( parameter list );
int max(int num1, int num2);
int max(1, 2);
Call Type
CALL BY VALUE
This method copies the actual value
of an argument into the formal
parameter of the function. In this
case, changes made to the
parameter inside the function have
no effect on the argument.
CALL BY REFERENCE
This method copies the reference
of an argument into the formal
parameter. Inside the function, the
reference is used to access the
actual argument used in the call.
This means that changes made to
the parameter affect the argument.
/passing parameters by reference
DefaultValuesfor
Parameters:
Total value is :300
Total value is :120
Functions with no type. The use of void.
Overloaded functions.
Strings
#include<string>
To initialize a variable of type string:
string s1=“hello”
string s2=“Net3lem”;
s1=s2;
s3=s1+s2;
s1.swap(s2);
S1=Net3lm
S2=hello
S1.size() or s1.length() get length of string
string library
Files manipulation
#include<fstream>
Including Library
#include<fstream>
Members of fstream are:
 Ifstream
 Ofstream
 Fstream
ofstream out (“name of the file with its extension”);
ifstream in (“name of the file with its extension”);
fstream both (“name of the file with its extension”);
Write on file Example
First we need to make an output file stream so:
Ofstream out (“file.txt”);
Then we can write by this way
Out<<“Welcome”<<“ ”<<“In”<<“ ”<<“Net3lem”;
Append on file
In ofstream we make a new file with this name and begin to write on it
What if I want to append on the file ?!
The solution : >> Ios:: app
Ofstream out (“file.txt” , ios::app);
Open() / close()
Ofstream out;
Out.open(“file.txt”,ios::app);
If(!out)
cout<<“File couldn’t be open”;
Out.close();
Read from a file
Ifstream In;
In.open(“file.txt”);
Int x,z;
Char y;
In>>x>>y>>z;
I must know the format of the file
Getline
Getline (name of ifstream , name of string,stopping character);
Ex:
getline(index,text,'|');
Eof()
while(!index.eof())
{
Statement 1;
Statmenet 2;
}
Bubble Sort
Intro
The Bubble sorting works at this way:
First: the program will compare between the first element & the second element
then between the first & the third then between the first & the forth then between
the first & the fifth “every time we do swapping if the condition met”
Second: the program will compare between the second & the third then between
the second & the forth then between the second & the fifth “every time we do
swapping if the condition met”
We repeat this till we reach the last element in the array
Implementation
The array before sorting is: (45,30,90,5,70)
The array after sorting is: (5,30,45,70,90)
We need two loops to implement this method
The first for loop will get the first element that we want to compare so we need
another for loop “the second one” to get the another elements from the array
Code
for(i=0;i<10;i++)
{
for(j=0;j<i;j++)
{
if(array[i]>array[j])
{
int temp=array[i]; //swap
array[i]=array[j];
array[j]=temp;
}}}
Arrays
Declaring Arrays
fixed-size sequential collection of elements of the same type.
type arrayName [ arraySize ];
double balance[10];
Initializing Arrays:
double balance[5] = {1000.0, 2.0, 3.4, 17.0, 50.0};.
double balance[] = {1000.0, 2.0, 3.4, 17.0, 50.0};
Accessing Array Elements:
balance[4] = 50.0;
double salary = balance[9];
Code
Multi-dimensional Arrays
type name[size1][size2]...[sizeN];
type arrayName [ x ][ y ];
int threedim[5][10][4];
AccessingTwo-DimensionalArrayElements:
int val = a[2][3];
Initializing Two-Dimensional Arrays:
int a[3][4] = {0,1,2,3,4,5,6,7,8,9,10,11};
Code
Pointers
Why
Some C++ tasks are performed more easily with pointers,
ampersand (&)
denotes an address in memory.
cout << "Address of var1 variable: ";
cout << &var1 << endl;
What Are Pointers?
A pointer is a variable whose value is the address of another variable.
Declaration
type *var-name;
int *ip; // pointer to an integer
double *dp; // pointer to a double
float *fp; // pointer to a float
char *ch // pointer to character
Recursion
Def
A recursive function in C++ is a function that calls itself.

More Related Content

PDF
The Ring programming language version 1.7 book - Part 30 of 196
PDF
The Ring programming language version 1.5.2 book - Part 26 of 181
PDF
The Ring programming language version 1.10 book - Part 35 of 212
PDF
The Ring programming language version 1.2 book - Part 16 of 84
PDF
The Ring programming language version 1.9 book - Part 32 of 210
PDF
The Ring programming language version 1.5.3 book - Part 26 of 184
PDF
The Ring programming language version 1.6 book - Part 28 of 189
PDF
The Ring programming language version 1.5.3 book - Part 25 of 184
The Ring programming language version 1.7 book - Part 30 of 196
The Ring programming language version 1.5.2 book - Part 26 of 181
The Ring programming language version 1.10 book - Part 35 of 212
The Ring programming language version 1.2 book - Part 16 of 84
The Ring programming language version 1.9 book - Part 32 of 210
The Ring programming language version 1.5.3 book - Part 26 of 184
The Ring programming language version 1.6 book - Part 28 of 189
The Ring programming language version 1.5.3 book - Part 25 of 184

What's hot (20)

PDF
The Ring programming language version 1.7 book - Part 7 of 196
PDF
The Ring programming language version 1.3 book - Part 18 of 88
PPTX
#5 (Remote Method Invocation)
PDF
C++ prgms io file unit 7
PPT
Ggug spock
PPTX
Multithreaded programming
PDF
cq_cxf_integration
KEY
Gevent what's the point
PDF
The Ring programming language version 1.5.1 book - Part 71 of 180
DOCX
Codes
DOCX
7th lab
PDF
The Ring programming language version 1.8 book - Part 18 of 202
PPTX
Config BuildConfig
PPTX
Web Services
PDF
Introduction kot iin
PDF
The Ring programming language version 1.10 book - Part 31 of 212
PDF
The Ring programming language version 1.5.2 book - Part 72 of 181
PDF
The Ring programming language version 1.9 book - Part 20 of 210
PDF
JAVA NIO
PDF
The Ring programming language version 1.5.3 book - Part 14 of 184
The Ring programming language version 1.7 book - Part 7 of 196
The Ring programming language version 1.3 book - Part 18 of 88
#5 (Remote Method Invocation)
C++ prgms io file unit 7
Ggug spock
Multithreaded programming
cq_cxf_integration
Gevent what's the point
The Ring programming language version 1.5.1 book - Part 71 of 180
Codes
7th lab
The Ring programming language version 1.8 book - Part 18 of 202
Config BuildConfig
Web Services
Introduction kot iin
The Ring programming language version 1.10 book - Part 31 of 212
The Ring programming language version 1.5.2 book - Part 72 of 181
The Ring programming language version 1.9 book - Part 20 of 210
JAVA NIO
The Ring programming language version 1.5.3 book - Part 14 of 184
Ad

Similar to C++ course start (20)

PPTX
ODT
Java practical
PPTX
Oop object oriented programing topics
DOCX
PPTX
Namespaces
DOCX
File handling in c++
PPT
Learning Java 1 – Introduction
PPTX
CP 04.pptx
PPT
Thread
PDF
The Ring programming language version 1.5.2 book - Part 14 of 181
PDF
streams and files
PPTX
Introduction to files management systems
PPTX
File & Exception Handling in C++.pptx
PPTX
Object Oriented Programming using C++: Ch12 Streams and Files.pptx
PPTX
Object Oriented Programming Using C++: Ch12 Streams and Files.pptx
PPTX
OOPS USING C++(UNIT 2)
PDF
The Ring programming language version 1.10 book - Part 22 of 212
PPT
Introduction to Basic C programming 01
PDF
Intake 38 5
PDF
The purpose of this C++ programming project is to allow the student .pdf
Java practical
Oop object oriented programing topics
Namespaces
File handling in c++
Learning Java 1 – Introduction
CP 04.pptx
Thread
The Ring programming language version 1.5.2 book - Part 14 of 181
streams and files
Introduction to files management systems
File & Exception Handling in C++.pptx
Object Oriented Programming using C++: Ch12 Streams and Files.pptx
Object Oriented Programming Using C++: Ch12 Streams and Files.pptx
OOPS USING C++(UNIT 2)
The Ring programming language version 1.10 book - Part 22 of 212
Introduction to Basic C programming 01
Intake 38 5
The purpose of this C++ programming project is to allow the student .pdf
Ad

Recently uploaded (20)

PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
sap open course for s4hana steps from ECC to s4
PPTX
Big Data Technologies - Introduction.pptx
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
Cloud computing and distributed systems.
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Digital-Transformation-Roadmap-for-Companies.pptx
sap open course for s4hana steps from ECC to s4
Big Data Technologies - Introduction.pptx
“AI and Expert System Decision Support & Business Intelligence Systems”
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Programs and apps: productivity, graphics, security and other tools
Reach Out and Touch Someone: Haptics and Empathic Computing
Unlocking AI with Model Context Protocol (MCP)
Diabetes mellitus diagnosis method based random forest with bat algorithm
Building Integrated photovoltaic BIPV_UPV.pdf
Network Security Unit 5.pdf for BCA BBA.
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Chapter 3 Spatial Domain Image Processing.pdf
Cloud computing and distributed systems.
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf

C++ course start