SlideShare a Scribd company logo
1 of 60
Download to read offline
C++ 
L01 -VARIABLES 
Programming Language 
Mohammad Shaker 
mohammadshaker.com 
@ZGTRShaker 
2010, 11, 12, 13, 14
C/ C++/ C++.NET/ C#
C/ C++/C++.NET/ C#
Who Are the C/C++Guys?
Dennis 
ritchie
bjarne 
stroustrup
Resources 
•Books 
–Deitel–C++ How to program 
–The C++ Programming Language (Not for complete starters) 
•Bunshof good websites 
–www.cplusplus.com 
–www.msdn.com 
•msdnawesome library 
•stackoverflow.comand googleare always your best programming buddies
What You Will Learn 
•Concepts you already know 
–Variables 
–Control Structure 
–Functions 
–Arrays/ Pointers/ Strings 
–Structs 
•New concepts 
–Classes (OOP) 
–Inheritance (OOP) 
–Polymorphism (OOP) 
–Template 
–STL 
–Exception Handling 
–File Processing
Programming Languages War 
August 2014, Source: http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html
Moore’s Law and Other Stuff
C++ Preferences & features 
•Moore’s Law 
–Computer processing power can be doubled every 18-24 months 
–Software with Hardware improves together 
•More complicated Hardware 
•More advanced Software 
–Now, we are in generation that we put the "Moore’s Law" behind us!
C++ Preferences & features 
•Two kind of Computer programming paradigms: 
–Imperative 
•Procedural(Pascal, C, php, etc) 
•Object-Oriented(C++, C#, Java, ASP.NET, etc) 
–Declarative 
•Functional(Pascal, C, php, etc) 
•Logic(Prolog, etc) 
____________________________________________________________________________ 
* Note the need to C++ after inventing C 
** Note that the Procedural Functional programming paradigms are still used till our present time and has its unique features
C C++ 
•The "C" Programming language is a modular one 
•Why C++ then? 
–Objects, OOP 
–C C++ are portables ones 
•Comparison: 
–C: is action Oriented 
•Procedural 
–C++: is object oriented 
•Compiler checking 
•Extensible language 
–Class 
•Reusable
Where you can find C++?
Where you can find C++? Pretty Everywhere! (Take a look here: http://www.stroustrup.com/applications.html) Microsoft, OfficeGoogleHPAmazonAdobeMozillaMySQLINTELNokiaSunBloombergGame Engines
Enough talk! Let’s get into the Action!
The Structure of a C++ Program
Structure of C++ program 
#include<iostream> 
voidmain () 
{ 
} 
#include<iostream> 
intmain () 
{ 
// indicate successful termination 
return0; 
} 
#include<iostream> 
usingnamespace::std; // Note the new namespace 
voidmain() 
{ 
cout<< "we're having fun!"; 
} 
#include<iostream> 
usingnamespace::std;// Note the new namespace 
intmain () 
{ 
cout<< "we're having fun!"; 
return0; // indicate successful termination 
}
Structure of C++ program 
#include<iostream> 
usingnamespace::std; // Note the namespace 
voidmain() 
{cout<< "we're having fun!";} 
#include<iostream> 
usingnamespace::std;// Note the namespace 
intmain () 
{ 
cout<< "we're having fun!";return0; 
} 
#include<iostream> 
usingnamespace::std; 
voidmain() 
{ 
cout<< "We're having fun!"; 
cout<< "I need to eat!:D "; 
} 
#include<iostream> 
usingnamespace::std; 
voidmain() 
{ 
cout<< "we're having fun!" << endl; 
cout<< "I need to eat!:D " << endl; 
} 
We're having fun!Ineed to eat!:D 
we're having fun! 
I need to eat!:D
Structure of C++ program 
#include<iostream> 
usingnamespace::std; 
voidmain() 
{ 
cout<< "we're having fun!"<< "n"<< "I need to eat!:D " 
<< "n"; 
} 
#include<iostream> 
usingnamespace::std; 
voidmain() 
{ 
cout<< "we're having fun! n I need to eat!:D n"; 
} 
we're having fun! 
I need to eat!:D 
we're having fun! 
I need to eat!:D nis the same as endl
Comments 
// comment 
For a one line 
/* 
comments 
*/ 
For one line or more (multi lines)
Structure of C++ program 
#include<iostream> 
usingnamespace::std; 
voidmain() 
{ 
cout<< "foo"; // this is a line! 
} 
#include<iostream> 
usingnamespace::std; 
voidmain() 
{ 
cout<< "foo"; /* this is a line! */ 
} 
Compile and run 
Compile and run
Structure of C++ program 
#include<iostream> 
usingnamespace::std; 
voidmain() 
{ 
cout<< "foo"; // this is 
a line! 
} 
#include<iostream> 
usingnamespace::std; 
voidmain() 
{ 
cout<< "foo"; /* this is not a single 
line! */ 
} 
Compiler error 
Compile and run
Escape code
I/O Stream 
•Keyboard / Screen 
Keyboard 
input stream 
Executing program 
screen 
Output 
stream
Variables
float, double, long double 
C++ data types 
Structured 
Simple 
Address 
Pointer 
Reference 
enum 
Floating 
Array 
Struct 
Union 
Class 
Char, Short, int, long, bool 
Integral
Variables 
•Every variable has: 
–Name 
–Type 
–Size 
–Value 
•Data Types: 
–Integer, Double, float, char
Variables 
#include<iostream> 
usingnamespace::std; 
voidmain() 
{ 
inti; 
float j; 
} 
#include<iostream> 
usingnamespace::std; 
voidmain() 
{ 
inti; 
intj; 
} 
Compile and Run 
Compile and Run 
#include<iostream> 
usingnamespace::std; 
voidmain() 
{ 
inti, j; 
} 
Compile and Run
Variables 
#include<iostream> 
usingnamespace::std; 
voidmain() 
{ 
inti, j; 
i= 0; 
j = 4; 
} 
#include<iostream> 
usingnamespace::std; 
voidmain() 
{ 
inti= 0, j = 4; 
} 
Compile and Run 
Compile and Run
Variables 
#include <iostream> 
using namespace::std; 
void main() 
{ 
inti; 
cin>> i; 
cout<< " i= " << I; 
} 
#include<iostream> 
usingnamespace::std; 
voidmain() 
{ 
intI; 
cout<< I; 
} 
Compiler error, undeclared "I" identifier 
C++ is case sensitive 
Runtime Error –Visual 2010 
Variable must be initialized
Variables 
#include<iostream> 
usingnamespace::std; 
voidmain() 
{ 
inti, j; 
cin>> i>> j; 
intsum = i+ j; 
cout<< sum; 
} 
#include<iostream> 
usingnamespace::std; 
voidmain() 
{ 
inti, j; 
cin>> i>> j; 
intsum = i+ j; 
cout<< “ sum = ” << sum; 
}
Variables 
// Operating with variables 
#include <iostream> 
usingnamespacestd; 
intmain () 
{ 
// declaring variables: 
inta, b; 
intresult; 
// process: 
a = 5; b = 2; a = a + 1; 
result = a -b; 
// print out the result: 
cout<< result; 
// terminate the program: 
return0; 
}
Variables 
#include<iostream> 
usingnamespacestd; 
voidmain() 
{ 
inti= 0; 
i= i+ 1; 
cout<< i; 
} 
#include<iostream> 
usingnamespacestd; 
voidmain() 
{ 
inti= 0; 
i+= 1; 
cout<< i; 
} 
1 
1 
#include<iostream> 
usingnamespacestd; 
voidmain() 
{ 
inti= 0; 
i++; 
cout<< i; 
} 
1
Variables 
#include<iostream> 
usingnamespacestd; 
voidmain() 
{ 
inti= 0; 
i--; 
cout<< i; 
} 
#include<iostream> 
usingnamespacestd; 
voidmain() 
{ 
inti, j; 
i++; 
j--; 
cout<< i<< j; 
} 
-1 
Runtime Error –Visual Studio 2010
Variables 
#include<iostream> 
usingnamespace::std; 
voidmain() 
{ 
inti, j; 
cin>> i; 
cout<< endl; 
cout<< "i= "<< i<< endl<< "t"; 
cin>> j; 
cout<< "j = n"<< j; 
cout<< "______________________________"<< endl; 
cout<< "j+i= "<< j+i<< "n"; 
cout<< "2*i= "<< 2*i<< "n"; 
} 
2 
i= 2 
3 
j = 
3______________________________ 
j+i= 5 
2*i= 4 
Press any key to continue
Float, double, long double 
C++ data types 
Structured 
Simple 
Address 
Pointer 
Reference 
enum 
Floating 
Array 
Struct 
Union 
Class 
Char, Short, int, long, bool 
Integral
integral
Integral 
•char, short, int, long, bool 
•char 
–Used to represent character such as: 
•Letters 
•Digits 
•Special symbols 
–' + ', ' & ', ' $ ', ' * ' 
–Each character is enclosed with single quote mark ' ' and not double ones " " 
–Space is represented by ' ' with space between them. 
–ASCII & EBCDIC 
•bool 
–Watch out that the "Boolean" type is an integral one! 
–bool 
•false = 0, true = any other number
integral 
#include<iostream> 
usingnamespace::std; 
voidmain() 
{ 
charc1 = 'd', c2; 
cout<< c2 << c1 << endl; 
} 
voidmain() 
{ 
boolb1, b2; 
if(3 <= 2) 
{ 
b1 = false; 
b2 = true; 
} 
else 
{ 
b1 = 53; 
} 
cout<< b1 << " -"<< b2 << endl; 
} 
d 
1 -0 
Note that: 
•The default value for a char is NULLrepresented as SPACE‘ ’ but it’s not a space, it’s a NULL! 
•The char has ' ' and not " " 
Note that: 
•A numeric value is printed when printing a "boolean" 
•The default value for booltype is false (0)
Floating point data types 
•float, double 
–float 4 bytes / double 8 bytes 
•float has a single precision 
•double has a double precision 
–double = long double (in new compilers) 
–The size of float, double, long double are machine dependent.
integral 
#include<iostream> 
usingnamespace::std; 
voidmain() 
{ 
doubled=0.4; 
cout<<d<<endl; 
system("pause"); 
} 
#include<iostream> 
usingnamespace::std; 
voidmain() 
{ 
doubled=0.0; 
cout<<d<<endl; 
system("pause"); 
} 
0.4 
0 
#include<iostream> 
usingnamespace::std; 
voidmain() 
{ 
doubled=.0; 
cout<<d<<endl; 
system("pause"); 
} 
#include<iostream> 
usingnamespace::std; 
voidmain() 
{ 
doubled=0.0; 
cout<<d<<endl; 
system("pause"); 
} 
0 
0
integral 
#include<iostream> 
usingnamespace::std; 
voidmain() 
{ 
floatf=1.2; 
cout<<f<<endl; 
system("pause"); 
} 
#include<iostream> 
usingnamespace::std; 
voidmain() 
{ 
floatf=1.2f; 
cout<<f<<endl; 
system("pause"); 
} 
1.2 
1.2
Constants, const
Constants 
•A Constant: 
–Any expression that has a “fixed” value 
•3 kind of constants: 
•Integer Numbers 
•Floating-Point Numbers 
•Characters & Strings
Constants 
•Integer Numbers 
–1225// Decimal 
–-982// Decimal 
–05356// Octal! 
•Octal numbers are preceded by 0 
–0x3c// Hexadecimal 
•Hexadecimal numbers are preceded by 0x 
•Floating Numbers 
–Decimal 
–Exponent 
Examples: 
–5.0// 5.0 (double) 
–5.0f// 5.0 (float) 
–45.556779// 45.556779 
–8.36e18// 8.36x 10^18 
–8.36e-18// 8.36x 10^-18 
•Characters and Strings 
–'Z' //Char –Single Character 
–'M' //Char –Single Character 
–"Where’s the cat?"//String – Several Character 
–"I just don’t know!"//String – Several Character 
–“c” //String –One Character
integral 
#include<iostream> 
usingnamespace::std; 
#definePI 3.14;// No “=” Sign 
#defineMyTab't‘// No “=” Sign 
#definePonPon":D“// No “=” Sign 
voidmain() 
{ 
} 
#include<iostream> 
usingnamespace::std; 
voidmain() 
{ 
#definePI 3.14; 
#defineMyTab't' 
#definePonPon":D“ 
}
integral 
#include<iostream> 
usingnamespace::std; 
#defineMyTab't' 
voidmain() 
{ 
#definePI 3.14; 
floatRadius = 0; 
cout<< "Enter the Radius"<< endl; 
cin>> Radius; 
floatCircle = PI; 
Circle = Circle * 2 * Radius; 
cout<< "The perimeter of the Circle = “<< Circle 
<< MyTab; 
} 
Enter the Radius 
3.2 
The perimeter of the Circle = 20.096 Press any key to continue
integral 
#include <iostream> 
using namespace::std; 
#define MyTab't' 
#define PI 5; 
void main() 
{ 
#define PI 3.14; 
float Radius = 0; 
cout<< "Enter the Radius" << endl; 
cin>> Radius; 
float Circle = PI; 
Circle = Circle * 2 * Radius; 
cout<< "The perimeter of the Circle = “<< Circle 
<< MyTab; 
} 
Enter the Radius 
3.2 
The perimeter of the Circle = 20.096 Press any key to continue
integral 
#include<iostream> 
usingnamespace::std; 
voidmain() 
{ 
#definePI 3.14; 
floatRadius = 0; 
cout<< "Enter the Radius"<< endl; 
cin>> Radius; 
floatCircle = 2 * PI * Radius; 
cout<< "The perimeter of the Circle = "<< Circle; 
} 
Illegal Indirection 2 * PI * Radius
integral 
#include<iostream> 
usingnamespace::std; 
constintx = 20; 
voidmain() 
{ 
constinty = 90; 
} 
Compile and run 
#include<iostream> 
usingnamespace::std; 
constintx = 20; 
voidmain() 
{ 
consty = 90; 
} 
2005 Compiler: Compile & Run 
intassumed for consttype when neglecting the type 
constcharMe = 'M'; 
constintHeight = 5; 
constcharMyCharTab= 't';// Char tab 
constchar*MyStringTab= "t"; // String tab 
voidmain() 
{ 
cout<< MyStringTab; 
} 
Press any key to continue 
constcharMyCharTab= 't';// Char tab 
constchar*MyStringTab= "t";// String tab 
#defineMyStringTab"t"; // String tab 
voidmain() 
{ 
cout<< MyStringTab; 
} 
Press any key to continue
Code Cracking 
#include<iostream> 
usingnamespace::std; 
voidmain() 
{ 
cout<<"I'm number 4 or 77, I don't know :D"<<endl; 
; 
; 
; 
; 
system("pause"); 
} 
I'm number 4 or 77, I don't know :D
Related Online CoursesProgramming ParadigmsC++ Memory Management. LISP and Pythonhttp://see.stanford.edu/see/courseinfo.aspx?coll=2d712634-2bf1-4b55-9a3a-ca9d470755eeProgramming methodology -Javahttp://see.stanford.edu/see/courseinfo.aspx?coll=824a47e1-135f-4508-a5aa-866adcae1111
Take a look at my other courses, Especially the GUI Course, C++.NEThttp://www.slideshare.net/ZGTRZGTR/
Keep in touch and let’s connect 
http://www.mohammadshaker.com 
mohammadshakergtr@gmail.com 
https://twitter.com/ZGTRShaker@ZGTRShakerhttps://de.linkedin.com/pub/mohammad-shaker/30/122/128/ 
http://www.slideshare.net/ZGTRZGTR 
https://www.goodreads.com/user/show/11193121-mohammad-shaker 
https://plus.google.com/u/0/+MohammadShaker/ 
https://www.youtube.com/channel/UCvJUfadMoEaZNWdagdMyCRA 
http://mohammadshakergtr.wordpress.com/
Hope you have enjoyed your first class
See YOU TOMORROW!

More Related Content

What's hot

C++ L03-Control Structure
C++ L03-Control StructureC++ L03-Control Structure
C++ L03-Control StructureMohammad Shaker
 
C++ L10-Inheritance
C++ L10-InheritanceC++ L10-Inheritance
C++ L10-InheritanceMohammad Shaker
 
2 BytesC++ course_2014_c9_ pointers and dynamic arrays
2 BytesC++ course_2014_c9_ pointers and dynamic arrays 2 BytesC++ course_2014_c9_ pointers and dynamic arrays
2 BytesC++ course_2014_c9_ pointers and dynamic arrays kinan keshkeh
 
c programming
c programmingc programming
c programmingArun Umrao
 
Modern C++ Concurrency API
Modern C++ Concurrency APIModern C++ Concurrency API
Modern C++ Concurrency APISeok-joon Yun
 
c programming
c programmingc programming
c programmingArun Umrao
 
Imugi: Compiler made with Python
Imugi: Compiler made with PythonImugi: Compiler made with Python
Imugi: Compiler made with PythonHan Lee
 
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 4 of 5 by...
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 4 of 5 by...Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 4 of 5 by...
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 4 of 5 by...ssuserd6b1fd
 
13 Strings and Text Processing
13 Strings and Text Processing13 Strings and Text Processing
13 Strings and Text ProcessingIntro C# Book
 
Notes for C++ Programming / Object Oriented C++ Programming for MCA, BCA and ...
Notes for C++ Programming / Object Oriented C++ Programming for MCA, BCA and ...Notes for C++ Programming / Object Oriented C++ Programming for MCA, BCA and ...
Notes for C++ Programming / Object Oriented C++ Programming for MCA, BCA and ...ssuserd6b1fd
 
Recursion to iteration automation.
Recursion to iteration automation.Recursion to iteration automation.
Recursion to iteration automation.Russell Childs
 
Антихрупкий TypeScript | Odessa Frontend Meetup #17
Антихрупкий TypeScript | Odessa Frontend Meetup #17Антихрупкий TypeScript | Odessa Frontend Meetup #17
Антихрупкий TypeScript | Odessa Frontend Meetup #17OdessaFrontend
 
Arduino coding class
Arduino coding classArduino coding class
Arduino coding classJonah Marrs
 
Arduino coding class part ii
Arduino coding class part iiArduino coding class part ii
Arduino coding class part iiJonah Marrs
 
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 5 of 5 by...
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 5 of 5 by...Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 5 of 5 by...
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 5 of 5 by...ssuserd6b1fd
 
Fp201 unit4
Fp201 unit4Fp201 unit4
Fp201 unit4rohassanie
 
Programming with GUTs
Programming with GUTsProgramming with GUTs
Programming with GUTsKevlin Henney
 

What's hot (20)

C++ L03-Control Structure
C++ L03-Control StructureC++ L03-Control Structure
C++ L03-Control Structure
 
C++ L10-Inheritance
C++ L10-InheritanceC++ L10-Inheritance
C++ L10-Inheritance
 
Unit 3
Unit 3 Unit 3
Unit 3
 
2 BytesC++ course_2014_c9_ pointers and dynamic arrays
2 BytesC++ course_2014_c9_ pointers and dynamic arrays 2 BytesC++ course_2014_c9_ pointers and dynamic arrays
2 BytesC++ course_2014_c9_ pointers and dynamic arrays
 
c programming
c programmingc programming
c programming
 
Modern C++ Concurrency API
Modern C++ Concurrency APIModern C++ Concurrency API
Modern C++ Concurrency API
 
c programming
c programmingc programming
c programming
 
Imugi: Compiler made with Python
Imugi: Compiler made with PythonImugi: Compiler made with Python
Imugi: Compiler made with Python
 
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 4 of 5 by...
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 4 of 5 by...Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 4 of 5 by...
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 4 of 5 by...
 
13 Strings and Text Processing
13 Strings and Text Processing13 Strings and Text Processing
13 Strings and Text Processing
 
C++11
C++11C++11
C++11
 
Notes for C++ Programming / Object Oriented C++ Programming for MCA, BCA and ...
Notes for C++ Programming / Object Oriented C++ Programming for MCA, BCA and ...Notes for C++ Programming / Object Oriented C++ Programming for MCA, BCA and ...
Notes for C++ Programming / Object Oriented C++ Programming for MCA, BCA and ...
 
Recursion to iteration automation.
Recursion to iteration automation.Recursion to iteration automation.
Recursion to iteration automation.
 
Антихрупкий TypeScript | Odessa Frontend Meetup #17
Антихрупкий TypeScript | Odessa Frontend Meetup #17Антихрупкий TypeScript | Odessa Frontend Meetup #17
Антихрупкий TypeScript | Odessa Frontend Meetup #17
 
Arduino coding class
Arduino coding classArduino coding class
Arduino coding class
 
C++ Pointers
C++ PointersC++ Pointers
C++ Pointers
 
Arduino coding class part ii
Arduino coding class part iiArduino coding class part ii
Arduino coding class part ii
 
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 5 of 5 by...
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 5 of 5 by...Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 5 of 5 by...
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 5 of 5 by...
 
Fp201 unit4
Fp201 unit4Fp201 unit4
Fp201 unit4
 
Programming with GUTs
Programming with GUTsProgramming with GUTs
Programming with GUTs
 

Viewers also liked

Python Programming: Variables
Python Programming: VariablesPython Programming: Variables
Python Programming: VariablesLeena Levashvili
 
Using Variables in Programming
Using Variables in ProgrammingUsing Variables in Programming
Using Variables in Programmingflippanthorse6864
 
Variables and data types in C++
Variables and data types in C++Variables and data types in C++
Variables and data types in C++Ameer Khan
 
A presentation on types of network
A presentation on types of networkA presentation on types of network
A presentation on types of networkSUSHANT RATHOR
 
Constants and variables in c programming
Constants and variables in c programmingConstants and variables in c programming
Constants and variables in c programmingChitrank Dixit
 
Chapter1 c programming data types, variables and constants
Chapter1 c programming   data types, variables and constantsChapter1 c programming   data types, variables and constants
Chapter1 c programming data types, variables and constantsvinay arora
 
Types of computer networks
Types of computer networksTypes of computer networks
Types of computer networksHarsh Sachdev
 
Getting started with c++
Getting started with c++Getting started with c++
Getting started with c++K Durga Prasad
 
Overview of programming paradigms
Overview of programming paradigmsOverview of programming paradigms
Overview of programming paradigmsDavid-Frelin Johnson
 
Lecture 2 C++ | Variable Scope, Operators in c++
Lecture 2 C++ | Variable Scope, Operators in c++Lecture 2 C++ | Variable Scope, Operators in c++
Lecture 2 C++ | Variable Scope, Operators in c++Himanshu Kaushik
 
Input and output in C++
Input and output in C++Input and output in C++
Input and output in C++Nilesh Dalvi
 
Stream classes in C++
Stream classes in C++Stream classes in C++
Stream classes in C++Shyam Gupta
 
Prgramming paradigms
Prgramming paradigmsPrgramming paradigms
Prgramming paradigmsAnirudh Chauhan
 
Presentation on nesting of loops
Presentation on nesting of loopsPresentation on nesting of loops
Presentation on nesting of loopsbsdeol28
 
types of computer networks, protocols and standards
types of computer networks, protocols and standardstypes of computer networks, protocols and standards
types of computer networks, protocols and standardsMidhun Menon
 
Programming Paradigms
Programming ParadigmsProgramming Paradigms
Programming ParadigmsDirecti Group
 
Intro. to prog. c++
Intro. to prog. c++Intro. to prog. c++
Intro. to prog. c++KurdGul
 
Unit1 principle of programming language
Unit1 principle of programming languageUnit1 principle of programming language
Unit1 principle of programming languageVasavi College of Engg
 

Viewers also liked (20)

Python Programming: Variables
Python Programming: VariablesPython Programming: Variables
Python Programming: Variables
 
Using Variables in Programming
Using Variables in ProgrammingUsing Variables in Programming
Using Variables in Programming
 
Variables and data types in C++
Variables and data types in C++Variables and data types in C++
Variables and data types in C++
 
A presentation on types of network
A presentation on types of networkA presentation on types of network
A presentation on types of network
 
Overloading of io stream operators
Overloading of io stream operatorsOverloading of io stream operators
Overloading of io stream operators
 
Constants and variables in c programming
Constants and variables in c programmingConstants and variables in c programming
Constants and variables in c programming
 
Chapter1 c programming data types, variables and constants
Chapter1 c programming   data types, variables and constantsChapter1 c programming   data types, variables and constants
Chapter1 c programming data types, variables and constants
 
Types of computer networks
Types of computer networksTypes of computer networks
Types of computer networks
 
Getting started with c++
Getting started with c++Getting started with c++
Getting started with c++
 
Overview of programming paradigms
Overview of programming paradigmsOverview of programming paradigms
Overview of programming paradigms
 
Lecture 2 C++ | Variable Scope, Operators in c++
Lecture 2 C++ | Variable Scope, Operators in c++Lecture 2 C++ | Variable Scope, Operators in c++
Lecture 2 C++ | Variable Scope, Operators in c++
 
Input and output in C++
Input and output in C++Input and output in C++
Input and output in C++
 
Stream classes in C++
Stream classes in C++Stream classes in C++
Stream classes in C++
 
Prgramming paradigms
Prgramming paradigmsPrgramming paradigms
Prgramming paradigms
 
Paradigms
ParadigmsParadigms
Paradigms
 
Presentation on nesting of loops
Presentation on nesting of loopsPresentation on nesting of loops
Presentation on nesting of loops
 
types of computer networks, protocols and standards
types of computer networks, protocols and standardstypes of computer networks, protocols and standards
types of computer networks, protocols and standards
 
Programming Paradigms
Programming ParadigmsProgramming Paradigms
Programming Paradigms
 
Intro. to prog. c++
Intro. to prog. c++Intro. to prog. c++
Intro. to prog. c++
 
Unit1 principle of programming language
Unit1 principle of programming languageUnit1 principle of programming language
Unit1 principle of programming language
 

Similar to C++ L01-Variables

OOPS using C++
OOPS using C++OOPS using C++
OOPS using C++cpjcollege
 
Cs1123 11 pointers
Cs1123 11 pointersCs1123 11 pointers
Cs1123 11 pointersTAlha MAlik
 
Chp1(c 2 c++)
Chp1(c 2 c++)Chp1(c 2 c++)
Chp1(c 2 c++)Mohd Effandi
 
C++ Unit 1PPT which contains the Introduction and basic o C++ with OOOps conc...
C++ Unit 1PPT which contains the Introduction and basic o C++ with OOOps conc...C++ Unit 1PPT which contains the Introduction and basic o C++ with OOOps conc...
C++ Unit 1PPT which contains the Introduction and basic o C++ with OOOps conc...ANUSUYA S
 
Programming using c++ tool
Programming using c++ toolProgramming using c++ tool
Programming using c++ toolAbdullah Jan
 
Practical basics on c++
Practical basics on c++Practical basics on c++
Practical basics on c++Marco Izzotti
 
2 BytesC++ course_2014_c1_basicsc++
2 BytesC++ course_2014_c1_basicsc++2 BytesC++ course_2014_c1_basicsc++
2 BytesC++ course_2014_c1_basicsc++kinan keshkeh
 
Lecture 1 Introduction C++
Lecture 1 Introduction C++Lecture 1 Introduction C++
Lecture 1 Introduction C++Ajay Khatri
 
Presentation c++
Presentation c++Presentation c++
Presentation c++JosephAlex21
 
270_1_CIntro_Up_To_Functions.ppt
270_1_CIntro_Up_To_Functions.ppt270_1_CIntro_Up_To_Functions.ppt
270_1_CIntro_Up_To_Functions.pptUdhayaKumar175069
 
Survey of programming language getting started in C
Survey of programming language getting started in CSurvey of programming language getting started in C
Survey of programming language getting started in Cummeafruz
 
270 1 c_intro_up_to_functions
270 1 c_intro_up_to_functions270 1 c_intro_up_to_functions
270 1 c_intro_up_to_functionsray143eddie
 
270_1_CIntro_Up_To_Functions.ppt
270_1_CIntro_Up_To_Functions.ppt270_1_CIntro_Up_To_Functions.ppt
270_1_CIntro_Up_To_Functions.pptAlefya1
 
Begin with c++ Fekra Course #1
Begin with c++ Fekra Course #1Begin with c++ Fekra Course #1
Begin with c++ Fekra Course #1Amr Alaa El Deen
 
Hello world! Intro to C++
Hello world! Intro to C++Hello world! Intro to C++
Hello world! Intro to C++DSCIGDTUW
 
270_1_CIntro_Up_To_Functions.ppt
270_1_CIntro_Up_To_Functions.ppt270_1_CIntro_Up_To_Functions.ppt
270_1_CIntro_Up_To_Functions.pptJoshCasas1
 

Similar to C++ L01-Variables (20)

OOPS using C++
OOPS using C++OOPS using C++
OOPS using C++
 
Cs1123 11 pointers
Cs1123 11 pointersCs1123 11 pointers
Cs1123 11 pointers
 
Oops presentation
Oops presentationOops presentation
Oops presentation
 
Chp1(c 2 c++)
Chp1(c 2 c++)Chp1(c 2 c++)
Chp1(c 2 c++)
 
C++ Unit 1PPT which contains the Introduction and basic o C++ with OOOps conc...
C++ Unit 1PPT which contains the Introduction and basic o C++ with OOOps conc...C++ Unit 1PPT which contains the Introduction and basic o C++ with OOOps conc...
C++ Unit 1PPT which contains the Introduction and basic o C++ with OOOps conc...
 
Programming using c++ tool
Programming using c++ toolProgramming using c++ tool
Programming using c++ tool
 
Practical basics on c++
Practical basics on c++Practical basics on c++
Practical basics on c++
 
2 BytesC++ course_2014_c1_basicsc++
2 BytesC++ course_2014_c1_basicsc++2 BytesC++ course_2014_c1_basicsc++
2 BytesC++ course_2014_c1_basicsc++
 
Lecture 1 Introduction C++
Lecture 1 Introduction C++Lecture 1 Introduction C++
Lecture 1 Introduction C++
 
Introduction Of C++
Introduction Of C++Introduction Of C++
Introduction Of C++
 
Presentation c++
Presentation c++Presentation c++
Presentation c++
 
270_1_CIntro_Up_To_Functions.ppt
270_1_CIntro_Up_To_Functions.ppt270_1_CIntro_Up_To_Functions.ppt
270_1_CIntro_Up_To_Functions.ppt
 
Survey of programming language getting started in C
Survey of programming language getting started in CSurvey of programming language getting started in C
Survey of programming language getting started in C
 
270 1 c_intro_up_to_functions
270 1 c_intro_up_to_functions270 1 c_intro_up_to_functions
270 1 c_intro_up_to_functions
 
270_1_CIntro_Up_To_Functions.ppt
270_1_CIntro_Up_To_Functions.ppt270_1_CIntro_Up_To_Functions.ppt
270_1_CIntro_Up_To_Functions.ppt
 
Begin with c++ Fekra Course #1
Begin with c++ Fekra Course #1Begin with c++ Fekra Course #1
Begin with c++ Fekra Course #1
 
C++ basics
C++ basicsC++ basics
C++ basics
 
Hello world! Intro to C++
Hello world! Intro to C++Hello world! Intro to C++
Hello world! Intro to C++
 
Modern C++
Modern C++Modern C++
Modern C++
 
270_1_CIntro_Up_To_Functions.ppt
270_1_CIntro_Up_To_Functions.ppt270_1_CIntro_Up_To_Functions.ppt
270_1_CIntro_Up_To_Functions.ppt
 

More from Mohammad Shaker

12 Rules You Should to Know as a Syrian Graduate
12 Rules You Should to Know as a Syrian Graduate12 Rules You Should to Know as a Syrian Graduate
12 Rules You Should to Know as a Syrian GraduateMohammad Shaker
 
Ultra Fast, Cross Genre, Procedural Content Generation in Games [Master Thesis]
Ultra Fast, Cross Genre, Procedural Content Generation in Games [Master Thesis]Ultra Fast, Cross Genre, Procedural Content Generation in Games [Master Thesis]
Ultra Fast, Cross Genre, Procedural Content Generation in Games [Master Thesis]Mohammad Shaker
 
Interaction Design L06 - Tricks with Psychology
Interaction Design L06 - Tricks with PsychologyInteraction Design L06 - Tricks with Psychology
Interaction Design L06 - Tricks with PsychologyMohammad Shaker
 
Short, Matters, Love - Passioneers Event 2015
Short, Matters, Love -  Passioneers Event 2015Short, Matters, Love -  Passioneers Event 2015
Short, Matters, Love - Passioneers Event 2015Mohammad Shaker
 
Unity L01 - Game Development
Unity L01 - Game DevelopmentUnity L01 - Game Development
Unity L01 - Game DevelopmentMohammad Shaker
 
Android L07 - Touch, Screen and Wearables
Android L07 - Touch, Screen and WearablesAndroid L07 - Touch, Screen and Wearables
Android L07 - Touch, Screen and WearablesMohammad Shaker
 
Interaction Design L03 - Color
Interaction Design L03 - ColorInteraction Design L03 - Color
Interaction Design L03 - ColorMohammad Shaker
 
Interaction Design L05 - Typography
Interaction Design L05 - TypographyInteraction Design L05 - Typography
Interaction Design L05 - TypographyMohammad Shaker
 
Interaction Design L04 - Materialise and Coupling
Interaction Design L04 - Materialise and CouplingInteraction Design L04 - Materialise and Coupling
Interaction Design L04 - Materialise and CouplingMohammad Shaker
 
Android L05 - Storage
Android L05 - StorageAndroid L05 - Storage
Android L05 - StorageMohammad Shaker
 
Android L04 - Notifications and Threading
Android L04 - Notifications and ThreadingAndroid L04 - Notifications and Threading
Android L04 - Notifications and ThreadingMohammad Shaker
 
Android L09 - Windows Phone and iOS
Android L09 - Windows Phone and iOSAndroid L09 - Windows Phone and iOS
Android L09 - Windows Phone and iOSMohammad Shaker
 
Interaction Design L01 - Mobile Constraints
Interaction Design L01 - Mobile ConstraintsInteraction Design L01 - Mobile Constraints
Interaction Design L01 - Mobile ConstraintsMohammad Shaker
 
Interaction Design L02 - Pragnanz and Grids
Interaction Design L02 - Pragnanz and GridsInteraction Design L02 - Pragnanz and Grids
Interaction Design L02 - Pragnanz and GridsMohammad Shaker
 
Android L10 - Stores and Gaming
Android L10 - Stores and GamingAndroid L10 - Stores and Gaming
Android L10 - Stores and GamingMohammad Shaker
 
Android L06 - Cloud / Parse
Android L06 - Cloud / ParseAndroid L06 - Cloud / Parse
Android L06 - Cloud / ParseMohammad Shaker
 
Android L08 - Google Maps and Utilities
Android L08 - Google Maps and UtilitiesAndroid L08 - Google Maps and Utilities
Android L08 - Google Maps and UtilitiesMohammad Shaker
 
Android L03 - Styles and Themes
Android L03 - Styles and Themes Android L03 - Styles and Themes
Android L03 - Styles and Themes Mohammad Shaker
 
Android L02 - Activities and Adapters
Android L02 - Activities and AdaptersAndroid L02 - Activities and Adapters
Android L02 - Activities and AdaptersMohammad Shaker
 
Android L01 - Warm Up
Android L01 - Warm UpAndroid L01 - Warm Up
Android L01 - Warm UpMohammad Shaker
 

More from Mohammad Shaker (20)

12 Rules You Should to Know as a Syrian Graduate
12 Rules You Should to Know as a Syrian Graduate12 Rules You Should to Know as a Syrian Graduate
12 Rules You Should to Know as a Syrian Graduate
 
Ultra Fast, Cross Genre, Procedural Content Generation in Games [Master Thesis]
Ultra Fast, Cross Genre, Procedural Content Generation in Games [Master Thesis]Ultra Fast, Cross Genre, Procedural Content Generation in Games [Master Thesis]
Ultra Fast, Cross Genre, Procedural Content Generation in Games [Master Thesis]
 
Interaction Design L06 - Tricks with Psychology
Interaction Design L06 - Tricks with PsychologyInteraction Design L06 - Tricks with Psychology
Interaction Design L06 - Tricks with Psychology
 
Short, Matters, Love - Passioneers Event 2015
Short, Matters, Love -  Passioneers Event 2015Short, Matters, Love -  Passioneers Event 2015
Short, Matters, Love - Passioneers Event 2015
 
Unity L01 - Game Development
Unity L01 - Game DevelopmentUnity L01 - Game Development
Unity L01 - Game Development
 
Android L07 - Touch, Screen and Wearables
Android L07 - Touch, Screen and WearablesAndroid L07 - Touch, Screen and Wearables
Android L07 - Touch, Screen and Wearables
 
Interaction Design L03 - Color
Interaction Design L03 - ColorInteraction Design L03 - Color
Interaction Design L03 - Color
 
Interaction Design L05 - Typography
Interaction Design L05 - TypographyInteraction Design L05 - Typography
Interaction Design L05 - Typography
 
Interaction Design L04 - Materialise and Coupling
Interaction Design L04 - Materialise and CouplingInteraction Design L04 - Materialise and Coupling
Interaction Design L04 - Materialise and Coupling
 
Android L05 - Storage
Android L05 - StorageAndroid L05 - Storage
Android L05 - Storage
 
Android L04 - Notifications and Threading
Android L04 - Notifications and ThreadingAndroid L04 - Notifications and Threading
Android L04 - Notifications and Threading
 
Android L09 - Windows Phone and iOS
Android L09 - Windows Phone and iOSAndroid L09 - Windows Phone and iOS
Android L09 - Windows Phone and iOS
 
Interaction Design L01 - Mobile Constraints
Interaction Design L01 - Mobile ConstraintsInteraction Design L01 - Mobile Constraints
Interaction Design L01 - Mobile Constraints
 
Interaction Design L02 - Pragnanz and Grids
Interaction Design L02 - Pragnanz and GridsInteraction Design L02 - Pragnanz and Grids
Interaction Design L02 - Pragnanz and Grids
 
Android L10 - Stores and Gaming
Android L10 - Stores and GamingAndroid L10 - Stores and Gaming
Android L10 - Stores and Gaming
 
Android L06 - Cloud / Parse
Android L06 - Cloud / ParseAndroid L06 - Cloud / Parse
Android L06 - Cloud / Parse
 
Android L08 - Google Maps and Utilities
Android L08 - Google Maps and UtilitiesAndroid L08 - Google Maps and Utilities
Android L08 - Google Maps and Utilities
 
Android L03 - Styles and Themes
Android L03 - Styles and Themes Android L03 - Styles and Themes
Android L03 - Styles and Themes
 
Android L02 - Activities and Adapters
Android L02 - Activities and AdaptersAndroid L02 - Activities and Adapters
Android L02 - Activities and Adapters
 
Android L01 - Warm Up
Android L01 - Warm UpAndroid L01 - Warm Up
Android L01 - Warm Up
 

Recently uploaded

A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityMorshed Ahmed Rahath
 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxSCMS School of Architecture
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Call Girls Mumbai
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.Kamal Acharya
 
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills KuwaitKuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwaitjaanualu31
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptNANDHAKUMARA10
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueBhangaleSonal
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsArindam Chakraborty, Ph.D., P.E. (CA, TX)
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayEpec Engineered Technologies
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxJuliansyahHarahap1
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapRishantSharmaFr
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXssuser89054b
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfJiananWang21
 
Computer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersComputer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersMairaAshraf6
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"mphochane1998
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptxJIT KUMAR GUPTA
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesMayuraD1
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationBhangaleSonal
 
PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiessarkmank1
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . pptDineshKumar4165
 

Recently uploaded (20)

A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna Municipality
 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills KuwaitKuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
Computer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersComputer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to Computers
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equation
 
PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and properties
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 

C++ L01-Variables

  • 1. C++ L01 -VARIABLES Programming Language Mohammad Shaker mohammadshaker.com @ZGTRShaker 2010, 11, 12, 13, 14
  • 4. Who Are the C/C++Guys?
  • 7. Resources •Books –Deitel–C++ How to program –The C++ Programming Language (Not for complete starters) •Bunshof good websites –www.cplusplus.com –www.msdn.com •msdnawesome library •stackoverflow.comand googleare always your best programming buddies
  • 8.
  • 9. What You Will Learn •Concepts you already know –Variables –Control Structure –Functions –Arrays/ Pointers/ Strings –Structs •New concepts –Classes (OOP) –Inheritance (OOP) –Polymorphism (OOP) –Template –STL –Exception Handling –File Processing
  • 10. Programming Languages War August 2014, Source: http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html
  • 11. Moore’s Law and Other Stuff
  • 12. C++ Preferences & features •Moore’s Law –Computer processing power can be doubled every 18-24 months –Software with Hardware improves together •More complicated Hardware •More advanced Software –Now, we are in generation that we put the "Moore’s Law" behind us!
  • 13. C++ Preferences & features •Two kind of Computer programming paradigms: –Imperative •Procedural(Pascal, C, php, etc) •Object-Oriented(C++, C#, Java, ASP.NET, etc) –Declarative •Functional(Pascal, C, php, etc) •Logic(Prolog, etc) ____________________________________________________________________________ * Note the need to C++ after inventing C ** Note that the Procedural Functional programming paradigms are still used till our present time and has its unique features
  • 14. C C++ •The "C" Programming language is a modular one •Why C++ then? –Objects, OOP –C C++ are portables ones •Comparison: –C: is action Oriented •Procedural –C++: is object oriented •Compiler checking •Extensible language –Class •Reusable
  • 15. Where you can find C++?
  • 16. Where you can find C++? Pretty Everywhere! (Take a look here: http://www.stroustrup.com/applications.html) Microsoft, OfficeGoogleHPAmazonAdobeMozillaMySQLINTELNokiaSunBloombergGame Engines
  • 17.
  • 18.
  • 19. Enough talk! Let’s get into the Action!
  • 20. The Structure of a C++ Program
  • 21. Structure of C++ program #include<iostream> voidmain () { } #include<iostream> intmain () { // indicate successful termination return0; } #include<iostream> usingnamespace::std; // Note the new namespace voidmain() { cout<< "we're having fun!"; } #include<iostream> usingnamespace::std;// Note the new namespace intmain () { cout<< "we're having fun!"; return0; // indicate successful termination }
  • 22. Structure of C++ program #include<iostream> usingnamespace::std; // Note the namespace voidmain() {cout<< "we're having fun!";} #include<iostream> usingnamespace::std;// Note the namespace intmain () { cout<< "we're having fun!";return0; } #include<iostream> usingnamespace::std; voidmain() { cout<< "We're having fun!"; cout<< "I need to eat!:D "; } #include<iostream> usingnamespace::std; voidmain() { cout<< "we're having fun!" << endl; cout<< "I need to eat!:D " << endl; } We're having fun!Ineed to eat!:D we're having fun! I need to eat!:D
  • 23. Structure of C++ program #include<iostream> usingnamespace::std; voidmain() { cout<< "we're having fun!"<< "n"<< "I need to eat!:D " << "n"; } #include<iostream> usingnamespace::std; voidmain() { cout<< "we're having fun! n I need to eat!:D n"; } we're having fun! I need to eat!:D we're having fun! I need to eat!:D nis the same as endl
  • 24. Comments // comment For a one line /* comments */ For one line or more (multi lines)
  • 25. Structure of C++ program #include<iostream> usingnamespace::std; voidmain() { cout<< "foo"; // this is a line! } #include<iostream> usingnamespace::std; voidmain() { cout<< "foo"; /* this is a line! */ } Compile and run Compile and run
  • 26. Structure of C++ program #include<iostream> usingnamespace::std; voidmain() { cout<< "foo"; // this is a line! } #include<iostream> usingnamespace::std; voidmain() { cout<< "foo"; /* this is not a single line! */ } Compiler error Compile and run
  • 28. I/O Stream •Keyboard / Screen Keyboard input stream Executing program screen Output stream
  • 30. float, double, long double C++ data types Structured Simple Address Pointer Reference enum Floating Array Struct Union Class Char, Short, int, long, bool Integral
  • 31. Variables •Every variable has: –Name –Type –Size –Value •Data Types: –Integer, Double, float, char
  • 32. Variables #include<iostream> usingnamespace::std; voidmain() { inti; float j; } #include<iostream> usingnamespace::std; voidmain() { inti; intj; } Compile and Run Compile and Run #include<iostream> usingnamespace::std; voidmain() { inti, j; } Compile and Run
  • 33. Variables #include<iostream> usingnamespace::std; voidmain() { inti, j; i= 0; j = 4; } #include<iostream> usingnamespace::std; voidmain() { inti= 0, j = 4; } Compile and Run Compile and Run
  • 34. Variables #include <iostream> using namespace::std; void main() { inti; cin>> i; cout<< " i= " << I; } #include<iostream> usingnamespace::std; voidmain() { intI; cout<< I; } Compiler error, undeclared "I" identifier C++ is case sensitive Runtime Error –Visual 2010 Variable must be initialized
  • 35. Variables #include<iostream> usingnamespace::std; voidmain() { inti, j; cin>> i>> j; intsum = i+ j; cout<< sum; } #include<iostream> usingnamespace::std; voidmain() { inti, j; cin>> i>> j; intsum = i+ j; cout<< “ sum = ” << sum; }
  • 36. Variables // Operating with variables #include <iostream> usingnamespacestd; intmain () { // declaring variables: inta, b; intresult; // process: a = 5; b = 2; a = a + 1; result = a -b; // print out the result: cout<< result; // terminate the program: return0; }
  • 37. Variables #include<iostream> usingnamespacestd; voidmain() { inti= 0; i= i+ 1; cout<< i; } #include<iostream> usingnamespacestd; voidmain() { inti= 0; i+= 1; cout<< i; } 1 1 #include<iostream> usingnamespacestd; voidmain() { inti= 0; i++; cout<< i; } 1
  • 38. Variables #include<iostream> usingnamespacestd; voidmain() { inti= 0; i--; cout<< i; } #include<iostream> usingnamespacestd; voidmain() { inti, j; i++; j--; cout<< i<< j; } -1 Runtime Error –Visual Studio 2010
  • 39. Variables #include<iostream> usingnamespace::std; voidmain() { inti, j; cin>> i; cout<< endl; cout<< "i= "<< i<< endl<< "t"; cin>> j; cout<< "j = n"<< j; cout<< "______________________________"<< endl; cout<< "j+i= "<< j+i<< "n"; cout<< "2*i= "<< 2*i<< "n"; } 2 i= 2 3 j = 3______________________________ j+i= 5 2*i= 4 Press any key to continue
  • 40. Float, double, long double C++ data types Structured Simple Address Pointer Reference enum Floating Array Struct Union Class Char, Short, int, long, bool Integral
  • 42. Integral •char, short, int, long, bool •char –Used to represent character such as: •Letters •Digits •Special symbols –' + ', ' & ', ' $ ', ' * ' –Each character is enclosed with single quote mark ' ' and not double ones " " –Space is represented by ' ' with space between them. –ASCII & EBCDIC •bool –Watch out that the "Boolean" type is an integral one! –bool •false = 0, true = any other number
  • 43. integral #include<iostream> usingnamespace::std; voidmain() { charc1 = 'd', c2; cout<< c2 << c1 << endl; } voidmain() { boolb1, b2; if(3 <= 2) { b1 = false; b2 = true; } else { b1 = 53; } cout<< b1 << " -"<< b2 << endl; } d 1 -0 Note that: •The default value for a char is NULLrepresented as SPACE‘ ’ but it’s not a space, it’s a NULL! •The char has ' ' and not " " Note that: •A numeric value is printed when printing a "boolean" •The default value for booltype is false (0)
  • 44. Floating point data types •float, double –float 4 bytes / double 8 bytes •float has a single precision •double has a double precision –double = long double (in new compilers) –The size of float, double, long double are machine dependent.
  • 45. integral #include<iostream> usingnamespace::std; voidmain() { doubled=0.4; cout<<d<<endl; system("pause"); } #include<iostream> usingnamespace::std; voidmain() { doubled=0.0; cout<<d<<endl; system("pause"); } 0.4 0 #include<iostream> usingnamespace::std; voidmain() { doubled=.0; cout<<d<<endl; system("pause"); } #include<iostream> usingnamespace::std; voidmain() { doubled=0.0; cout<<d<<endl; system("pause"); } 0 0
  • 46. integral #include<iostream> usingnamespace::std; voidmain() { floatf=1.2; cout<<f<<endl; system("pause"); } #include<iostream> usingnamespace::std; voidmain() { floatf=1.2f; cout<<f<<endl; system("pause"); } 1.2 1.2
  • 48. Constants •A Constant: –Any expression that has a “fixed” value •3 kind of constants: •Integer Numbers •Floating-Point Numbers •Characters & Strings
  • 49. Constants •Integer Numbers –1225// Decimal –-982// Decimal –05356// Octal! •Octal numbers are preceded by 0 –0x3c// Hexadecimal •Hexadecimal numbers are preceded by 0x •Floating Numbers –Decimal –Exponent Examples: –5.0// 5.0 (double) –5.0f// 5.0 (float) –45.556779// 45.556779 –8.36e18// 8.36x 10^18 –8.36e-18// 8.36x 10^-18 •Characters and Strings –'Z' //Char –Single Character –'M' //Char –Single Character –"Where’s the cat?"//String – Several Character –"I just don’t know!"//String – Several Character –“c” //String –One Character
  • 50. integral #include<iostream> usingnamespace::std; #definePI 3.14;// No “=” Sign #defineMyTab't‘// No “=” Sign #definePonPon":D“// No “=” Sign voidmain() { } #include<iostream> usingnamespace::std; voidmain() { #definePI 3.14; #defineMyTab't' #definePonPon":D“ }
  • 51. integral #include<iostream> usingnamespace::std; #defineMyTab't' voidmain() { #definePI 3.14; floatRadius = 0; cout<< "Enter the Radius"<< endl; cin>> Radius; floatCircle = PI; Circle = Circle * 2 * Radius; cout<< "The perimeter of the Circle = “<< Circle << MyTab; } Enter the Radius 3.2 The perimeter of the Circle = 20.096 Press any key to continue
  • 52. integral #include <iostream> using namespace::std; #define MyTab't' #define PI 5; void main() { #define PI 3.14; float Radius = 0; cout<< "Enter the Radius" << endl; cin>> Radius; float Circle = PI; Circle = Circle * 2 * Radius; cout<< "The perimeter of the Circle = “<< Circle << MyTab; } Enter the Radius 3.2 The perimeter of the Circle = 20.096 Press any key to continue
  • 53. integral #include<iostream> usingnamespace::std; voidmain() { #definePI 3.14; floatRadius = 0; cout<< "Enter the Radius"<< endl; cin>> Radius; floatCircle = 2 * PI * Radius; cout<< "The perimeter of the Circle = "<< Circle; } Illegal Indirection 2 * PI * Radius
  • 54. integral #include<iostream> usingnamespace::std; constintx = 20; voidmain() { constinty = 90; } Compile and run #include<iostream> usingnamespace::std; constintx = 20; voidmain() { consty = 90; } 2005 Compiler: Compile & Run intassumed for consttype when neglecting the type constcharMe = 'M'; constintHeight = 5; constcharMyCharTab= 't';// Char tab constchar*MyStringTab= "t"; // String tab voidmain() { cout<< MyStringTab; } Press any key to continue constcharMyCharTab= 't';// Char tab constchar*MyStringTab= "t";// String tab #defineMyStringTab"t"; // String tab voidmain() { cout<< MyStringTab; } Press any key to continue
  • 55. Code Cracking #include<iostream> usingnamespace::std; voidmain() { cout<<"I'm number 4 or 77, I don't know :D"<<endl; ; ; ; ; system("pause"); } I'm number 4 or 77, I don't know :D
  • 56. Related Online CoursesProgramming ParadigmsC++ Memory Management. LISP and Pythonhttp://see.stanford.edu/see/courseinfo.aspx?coll=2d712634-2bf1-4b55-9a3a-ca9d470755eeProgramming methodology -Javahttp://see.stanford.edu/see/courseinfo.aspx?coll=824a47e1-135f-4508-a5aa-866adcae1111
  • 57. Take a look at my other courses, Especially the GUI Course, C++.NEThttp://www.slideshare.net/ZGTRZGTR/
  • 58. Keep in touch and let’s connect http://www.mohammadshaker.com mohammadshakergtr@gmail.com https://twitter.com/ZGTRShaker@ZGTRShakerhttps://de.linkedin.com/pub/mohammad-shaker/30/122/128/ http://www.slideshare.net/ZGTRZGTR https://www.goodreads.com/user/show/11193121-mohammad-shaker https://plus.google.com/u/0/+MohammadShaker/ https://www.youtube.com/channel/UCvJUfadMoEaZNWdagdMyCRA http://mohammadshakergtr.wordpress.com/
  • 59. Hope you have enjoyed your first class