C++ Notes
INTRODUCTION OF C++
[Link]
C++ Programming
Program or Software=
◦ The collection of instruction
Algorithm:
◦ Step by step execution of program
Flowchart
◦ The pictorial or diagrametical representation of a program
[Link]
Algorithm
WAA to route from shivar to yasham academy
◦ Decide the how to reach
◦ Before time to pick up auto
◦ Go to YA via bus stand.
◦ Finally you reach YA before 1pm
• WAA to addition of two nos
• Start
• Input value of two nos.
• Compute Addition
• Display Addition
• Stop
[Link]
Flowchart
Rounded Rectangle
Start or Stop
Rectangle
Declaration, Init, Process, Calc Data
Input, or Display
Arrows
Flow of execution
Diamond
Condition
[Link]
DAF to addition of two nos
Start
Declaration of two nos
Input of two nos
Addition Calculate
Display Addition
STOP
[Link]
C++ Programming
OOP (Object Oriented Programming )
Developed by Bjarne Stroustrup in 1979 at AT & T Bell Lab
Easy to understand
Functions, pointer, string, Class, Object, Decision making, Arrays and many more
[Link]
C++ Tokens
Variable
Datatype
Keywords
Operators
Identifiers
String
Constant
[Link]
Variable
Unknown part in a program
Flexible value
Rules:
◦ Every Variable must be begin with character
◦ Does not use any keyword
◦ Variable must be consist with A-Z, a-z,0-9 and special character (_).
◦ Case Sensitive
◦ Variable name short.
EX: Valid : int a; float x; char r; long int b; string t; int p_a;
invalid : int 1a; float c 4; string s1@k;
[Link]
Datatypes
Integer (int)
◦ Sign int, unsign int, long int, int, short int.
Ex: int x; long int r, signed int b;
Float (float)
◦ float(32 bit), double
Ex: float pi=3.14; double d=23455.88899766
Character (char)
◦ Char s; or char c=‘r’;
String
◦ String t=“yasham”;
Boolean
◦ Either true or false
Ex: bool k;
[Link]
Data types with Range
Data Type Size (in bytes) Range
short int 2 -32,768 to 32,767
unsigned short int 2 0 to 65,535
unsigned int 4 0 to 4,294,967,295
int 4 -2,147,483,648 to 2,147,483,647
long int 4 -2,147,483,648 to 2,147,483,647
unsigned long int 8 0 to 4,294,967,295
long long int 8 -(2^63) to (2^63)-1
unsigned long long int 8 0 to 18,446,744,073,709,551,615
signed char 1 -128 to 127
unsigned char 1 0 to 255
float 4
double 8
long double 12
[Link]
Keywords ( Reserve words) 48
asm double new switch
auto else operator template
break enum private this
case extern protected throw
catch float public try
char for register typedef
class friend return union
const goto short unsigned
continue if signed virtual
default inline sizedof void
delete int static volatile
do long struct while
Operators
Arithmetic Operators (+,-,*,/,%)
Relational Operators (>,<,>=,<=,==,!=)
Conditional(Ternary) Operators ( ?, :)
Assignment (=)
Increment/Decrement (++,--)
Logical (&&, ||, !)
Bitwise operator (&, |, ^)
[Link]
Identifiers
Every variable name, function name, class name may be identifier
Rules:
◦ Every Variable must be begin with character
◦ Does not use any keyword
◦ Variable must be consist with A-Z, a-z,0-9 and special character (_).
◦ Case Sensitive
◦ Variable name short.
EX: Valid : int a; float x; char r; long int b; string t; int p_a;
invalid : int 1a; float c 4; string s1@k;
[Link]
String
Therfore easy to perform all string manipulation
String compare, add, subtract, len, concate etc.
Ex: String a=“Welcome to yasham academy”;
[Link]
Constant (fix)
Backslash Constant
\n - Newline
\v – Vertical space
\a – Audiable bell
\t – Horizental Space
\\ - print backslash
\” – print Double quote
[Link]
Feel free to visit us for more information
Page 16
Website [Link]
Helpline 818283 8888/8883330419
Training Centre Mr. Vinod Pande
Head email: vinod@[Link]
Address Yasham Academy
2nd Floor, Shanti Krupa, Gandhi Chowk
Akola– 444 001
Social Profiles
@[Link]
Yasham Academy [Link]