SlideShare a Scribd company logo
1 of 63
Goal
Staff
Products
Contact us
01211992678 www.net3lem.com
01211992674 https://www.facebook.com/net3lem
C++ Course
Alaa Ramadan
Net3lem
History Of Programming Languages
// 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!
Physical Memory
Variable
a
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

What's hot

Multithreaded programming
Multithreaded programmingMultithreaded programming
Multithreaded programming
Sonam Sharma
 
Gevent what's the point
Gevent what's the pointGevent what's the point
Gevent what's the point
seanmcq
 

What's hot (20)

The Ring programming language version 1.7 book - Part 7 of 196
The Ring programming language version 1.7 book - Part 7 of 196The Ring programming language version 1.7 book - Part 7 of 196
The Ring programming language version 1.7 book - Part 7 of 196
 
The Ring programming language version 1.3 book - Part 18 of 88
The Ring programming language version 1.3 book - Part 18 of 88The Ring programming language version 1.3 book - Part 18 of 88
The Ring programming language version 1.3 book - Part 18 of 88
 
#5 (Remote Method Invocation)
#5 (Remote Method Invocation)#5 (Remote Method Invocation)
#5 (Remote Method Invocation)
 
C++ prgms io file unit 7
C++ prgms io file unit 7C++ prgms io file unit 7
C++ prgms io file unit 7
 
Ggug spock
Ggug spockGgug spock
Ggug spock
 
Multithreaded programming
Multithreaded programmingMultithreaded programming
Multithreaded programming
 
cq_cxf_integration
cq_cxf_integrationcq_cxf_integration
cq_cxf_integration
 
Gevent what's the point
Gevent what's the pointGevent what's the point
Gevent what's the point
 
The Ring programming language version 1.5.1 book - Part 71 of 180
The Ring programming language version 1.5.1 book - Part 71 of 180The Ring programming language version 1.5.1 book - Part 71 of 180
The Ring programming language version 1.5.1 book - Part 71 of 180
 
Codes
CodesCodes
Codes
 
7th lab
7th lab7th lab
7th lab
 
The Ring programming language version 1.8 book - Part 18 of 202
The Ring programming language version 1.8 book - Part 18 of 202The Ring programming language version 1.8 book - Part 18 of 202
The Ring programming language version 1.8 book - Part 18 of 202
 
Config BuildConfig
Config BuildConfigConfig BuildConfig
Config BuildConfig
 
Web Services
Web ServicesWeb Services
Web Services
 
Introduction kot iin
Introduction kot iinIntroduction kot iin
Introduction kot iin
 
The Ring programming language version 1.10 book - Part 31 of 212
The Ring programming language version 1.10 book - Part 31 of 212The Ring programming language version 1.10 book - Part 31 of 212
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.5.2 book - Part 72 of 181The Ring programming language version 1.5.2 book - Part 72 of 181
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
The Ring programming language version 1.9 book - Part 20 of 210The Ring programming language version 1.9 book - Part 20 of 210
The Ring programming language version 1.9 book - Part 20 of 210
 
JAVA NIO
JAVA NIOJAVA NIO
JAVA NIO
 
The Ring programming language version 1.5.3 book - Part 14 of 184
The Ring programming language version 1.5.3 book - Part 14 of 184The Ring programming language version 1.5.3 book - Part 14 of 184
The Ring programming language version 1.5.3 book - Part 14 of 184
 

Similar to C++ course start

File & Exception Handling in C++.pptx
File & Exception Handling in C++.pptxFile & Exception Handling in C++.pptx
File & Exception Handling in C++.pptx
RutujaTandalwade
 
The purpose of this C++ programming project is to allow the student .pdf
The purpose of this C++ programming project is to allow the student .pdfThe purpose of this C++ programming project is to allow the student .pdf
The purpose of this C++ programming project is to allow the student .pdf
Rahul04August
 
Java fundamentals
Java fundamentalsJava fundamentals
Java fundamentals
HCMUTE
 
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
julien.ponge
 
C++ - UNIT_-_V.pptx which contains details about File Concepts
C++  - UNIT_-_V.pptx which contains details about File ConceptsC++  - UNIT_-_V.pptx which contains details about File Concepts
C++ - UNIT_-_V.pptx which contains details about File Concepts
ANUSUYA S
 

Similar to C++ course start (20)

Introduction to c ++ part -2
Introduction to c ++   part -2Introduction to c ++   part -2
Introduction to c ++ part -2
 
Java practical
Java practicalJava practical
Java practical
 
Oop object oriented programing topics
Oop object oriented programing topicsOop object oriented programing topics
Oop object oriented programing topics
 
srgoc
srgocsrgoc
srgoc
 
Namespaces
NamespacesNamespaces
Namespaces
 
File handling in c++
File handling in c++File handling in c++
File handling in c++
 
Learning Java 1 – Introduction
Learning Java 1 – IntroductionLearning Java 1 – Introduction
Learning Java 1 – Introduction
 
CP 04.pptx
CP 04.pptxCP 04.pptx
CP 04.pptx
 
Thread
ThreadThread
Thread
 
The Ring programming language version 1.5.2 book - Part 14 of 181
The Ring programming language version 1.5.2 book - Part 14 of 181The Ring programming language version 1.5.2 book - Part 14 of 181
The Ring programming language version 1.5.2 book - Part 14 of 181
 
streams and files
 streams and files streams and files
streams and files
 
File & Exception Handling in C++.pptx
File & Exception Handling in C++.pptxFile & Exception Handling in C++.pptx
File & Exception Handling in C++.pptx
 
OOPS USING C++(UNIT 2)
OOPS USING C++(UNIT 2)OOPS USING C++(UNIT 2)
OOPS USING C++(UNIT 2)
 
The Ring programming language version 1.10 book - Part 22 of 212
The Ring programming language version 1.10 book - Part 22 of 212The Ring programming language version 1.10 book - Part 22 of 212
The Ring programming language version 1.10 book - Part 22 of 212
 
Introduction to Basic C programming 01
Introduction to Basic C programming 01Introduction to Basic C programming 01
Introduction to Basic C programming 01
 
Intake 38 5
Intake 38 5Intake 38 5
Intake 38 5
 
The purpose of this C++ programming project is to allow the student .pdf
The purpose of this C++ programming project is to allow the student .pdfThe purpose of this C++ programming project is to allow the student .pdf
The purpose of this C++ programming project is to allow the student .pdf
 
Java fundamentals
Java fundamentalsJava fundamentals
Java fundamentals
 
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
 
C++ - UNIT_-_V.pptx which contains details about File Concepts
C++  - UNIT_-_V.pptx which contains details about File ConceptsC++  - UNIT_-_V.pptx which contains details about File Concepts
C++ - UNIT_-_V.pptx which contains details about File Concepts
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 

C++ course start