SlideShare une entreprise Scribd logo
1  sur  283
####ìÍ##=Eu#øÍ##ˆþ##ˆþ##½Ou#'Eu#####ˆþ##ìÍ##ìÍ##°###$Î##½'#######Þ##ÝDu#øÍ##
###NˆÞ¢º#Í#Ô#ÔæiKÃ# #à3ˆ#Í######Ò######ˆ# @new c++
08.doc#c#s.doc#g#Visual.Basic.2010.Mar.2010.pdf#d Database Applications
Comprehensive.pdf#s_files#d from over 100 stock photo companies_files#ˆ|ØÎ###³ˆ|
üÎ##äÎ###Rˆ|
Ï##ä#######Ô#######$Ï###Tˆ|
Ï##Ô###############¨Ï## ###ÔWhôÏ##¡Wˆ|@Ð##########°Ï## ###NEWC__~1.DOC##
%#ôÑ##U_ˆ|j!ˆ|#üýˆˆ_ˆ|øûýˆ##%#####ÈÏ##´Ï##hÏ## #######¸Ï##ÍUˆ|ˆÏ##Ȳˆ|
´Ï##¬Ï###Ð##èÐ##############ˆÒ##########################,###|Ð##Ɉ|######## ###
@Ð##ÜÏ##`³ˆ|']ˆ|
@#####################################################################
#########HÐ##########¨Ð########
##üýˆ[8######ßXˆ|####tÐ##tÐ##tÐ##########¬Ð##¼êˆ|####[8##äÑ###Ñ##äÑ##Ø[ˆ|
ÐÐ##øûýˆ##%#=ˆ|þjˆ|`³ˆ|ˆ#%#####øûýˆ@Ò######ˆÒ######ðÔ######@Ñ################
##üýˆ#####Ñ##########
Ñ###Rˆ|4Ñ##ä#######Ô#######LÑ###Tˆ|4Ñ##Ô###PÑ########ˆ|E###x#######
##(Ñ##hÒ##lÓ###éˆ|##ˆ|ÿÿÿÿ##ˆ|{#ˆ|»#ˆ|#### Ö##xÖ##j!ˆ|#üýˆˆ_ˆ|øûýˆˆ/
%#####ðÑ##ÜÑ##ˆÑ## #######àÑ##ÍUˆ|¸Ñ##Ȳˆ|
ÜÑ##ÔÑ##DÒ###Ó##############¸Ô##########################,###¤Ò##Ɉ|######## ###
hÒ###Ò##`³ˆ|']ˆ|
@#####################################################################
#####ˆ#A~####¯#A~####ÐÒ########
##üýˆ[8######ßXˆ|####ˆÒ##ˆÒ####ˆ|##ˆ|üÕ##$###èÓ##gˆˆ|üÒ### ýˆ##ˆ|ˆ
Ò######`Ó###éˆ|@#ˆ|#Öˆ|)@ˆ|#@ˆ|#### Ö##xÖ##0####Ô##àˆÝw#Ô###Ô##òÓ###Ô##########0
#2#ÜÖ######dÔ##ÜÖ######0###E###ˆ###0###########$Ô##########ôÓ##############
×####ˆ|##ˆ|[8##ÌÒ##xÖ##
Ö###éˆ| Ö## Ó########ˆ|E###x####### ##xÓ##ˆBˆ|¼Õ###éˆ|##ˆ|ÿÿÿÿ##ˆ|{#ˆ|»#ˆ|
#Ù###Ù##ØØ##########À#Éq[8####Éq0#######x#Éq#?ˆ|0#2#ÜÖ##ôÓ######
##Ô#####.##P#I#P#E##D#A#V# #R#P#C#
#S#E#R#V#I#C#E##################################################################
###############################################°Ô###Rˆ|
ØÔ##ä#######Ô#######ðÔ###Tˆ|ØÔ##ˆÓˆ|ˆ#ˆ|©###############ôÔ##(#
      #####################hCˆ|#########Õ##܈ˆ|ˆ#######@#ˆ|#Öˆ|)@ˆ|#@ˆ|
#####Ù##ØØ######4Õ## #######ˆÕ##BÖ##Õ###############üýˆ#Ù#######üýˆ########E###
################PÖ##
###HÖ##DÖ######
###ˆ###NÖ####ˆ|ÔÕ########ˆ|####x#######ˆ###¬Õ######ð×###éˆ|##ˆ|ÿÿÿÿ##ˆ|{#ˆ|»#ˆ|
Ä=##°=#############$####ðýˆ######
#@ˆ|#####Ù##########PÖ######TÖ########ˆ|####Ø#######°=##,Ö## ###pØ###éˆ|##ˆ|
ÿÿÿÿ##ˆ|{#ˆ|»#ˆ|õ ˆ|
ÀÛ##############################################################################
################################################################################
################################################################################
########################################Ù#ˆ|
Ä=##ˆ###################################################ì×########ˆ|E###x#######
 ##Ä×#######Ú###éˆ|#Ø########ˆ|E###x####### ##ð×##¶#ˆ|4Ú###éˆ|DØ########ˆ|
E###x####### ###Ø##XØ##`Ú###éˆ|##ˆ|ÿÿÿÿ##ˆ|{#ˆ|»#ˆ|####ˆÝ######8###
#######`Ö##ˆÕˆ|ˆþ###éˆ|ˆØ##
#ˆ|Ä=######ˆØ##ïˆ|Ä=##õ ˆ|ÀÛ##ˆÛ##5îˆ|¬###$Þ######Hîˆ|
#########Ù##@###########ÀÛ###üýˆ ######´ ##########`########üýˆ############´
##С##ˆÓˆ|ˆ#ˆ|©###############@Ù##(#     #############ˆÓˆ|ˆ#ˆ|
©###############lÙ##(# ###########ˆ|½Ou###@###@###@#`Ù######ˆÙ##e#ˆ|
##@#########¼Ù####ˆ|½Ou###ˆ|#Ý##à#ˆ|ˆÙ######ÀÝ###éˆ|##ˆ|ÿÿÿÿ##ˆ|ì^ˆ|#«ˆ|x±ˆ|
####ÀÝ######ìÝ##jHúˆ#Pu##Ú##¨2ˆ|ÐÚ##ÀÝ##ðÚ##¤Ú##ÀÝ##¼2ˆ|ÀÝ##¸Ú##z2ˆ|
ÐÚ##ÀÝ##ðÚ##¤Ú##½Ou#####ÐÚ##ÀÝ##煮|ÐÚ##ÀÝ##ðÚ##¤Ú##½Ou#####ÐÚ##ˆþ###Ý###éˆ|ˆ
Ý#######Ý###Bˆ|¨ ##èÚ##@#ˆ|#Öˆ|ÇBˆ|ˆBˆ|>###(×##################
#2#######
#@ˆ|#####ð## ##ìÝ##jäˆ|LЈ|xäˆ|ðÚ#########ˆ#########Eu##########$ˆ|ôäˆ|?
###########################ˆ#ÿÿ
@ÿÿÿÿÿÿˆn=w##"#H#=w##ÿÿp#"#ô×##P###########D###A#p#p#a#t#i#o#n#l#e###M#F#p#p#l#i
#c########ˆÿ?#######ˆÿ?########;###############ˆþ##°=##ôäˆ|#$ˆ|
####ìÝ###Pu#####F###¼Ý######ˆ#
@##"#ˆn=w####H#=w##ÿÿˆ###ÿÿ##p#"#ô×##P#######################D###A#p#p#######a#t
#i#o#n#######l#e###M#F#######p#p#l#i#c##############ˆÿ?#############ˆÿ?
##########,Ù##¬Ü#C########,Ù##¬Ü#C########ÖÜ##ˆ4##ÀØ##{pÝw´###
´Ø##ØØ##p#"#ÐØ##ÈØ##
´########à######H8÷w####8Ý##·BöwD###H8÷wD###dÝ#######à##dÝ###à##ÂBöwdÝ##########
p#"##à##¬Þ##ˆ#######ÿÿÿÿÅoˆ|ˆ#ˆ#LÜ##,Ù######x>##ì###C#:##D#o#c#u#m#e#n#t#s#
#a#n#d#
#S#e#t#t#i#n#g#s##A#d#m#i#n#i#s#t#r#a#t#o#r##>,##ÄÚ##ÄÚ##ÐCöwÿÿ###Û###########
æ##øˆˆ|ÝCöwøˆˆ|########òOu#ÞOu#ˆþ##ˆþ##½Ou##Eu#####ˆþ##ìÝ##ìÝ##°=###Öˆ|Uéˆ|
#####Þ##ˆDu#PÞ######ˆþ###Þ###Þ##°=##PÞ##½'##C++
Dî##ÔDu#PÞ######Üá# º#Í#ú·#Lˆ§Ä#ˆçˆèiKÃ#############ˆ# @C++ Hazrat Ali Nasar
Nots#hm#eference.May.2008.pdf## ###`#°ÜÞ##¡Wˆ|Àß##########0ß## ######Àøûýˆˆ#%#¼#
%#tá##U_ˆ|ôÞ########ˆ|E###x####### ##ÌÞ##èÞ###á###éˆ|##ˆ|ÿÿÿÿ##ˆ|{#ˆ|»#ˆ|
#ß###Rˆ|Dß##ä#######Ô#######ß###Tˆ|Dß##Ô###############àß## ###ÔWhôˆß##¡Wˆ|
xà######C__HAZ~1#TXT###Àøûýˆ##%#T#%#,â##U_ˆ|j!ˆ|#üýˆˆ_ˆ|øûýˆ##%######à##ìß## ß##
#######ðß##ÍUˆ|Èß##Ȳˆ|ìß##äß##Tà## á##############Èâ############## language
called ˆC with Classesˆ. Rick Mascitti suggested the name C++.Event Year
DescriptionC with Classes 1979-1983 Adding classes with a preprocessorEvolution
of C++ 1882-1985 First Commercial releaseRelease 2.0 1985-1988 Early Commercial
useGrowth in Use 1987 Large Scale UseStandardization 1988Basic Feature of C++1.
It is the super set/extension of C language, it supports almost every feature of
C language, additionally it has itsown distinguish features.2. C++ is a general-
purpose object oriented programming language.3. C++ is case sensitive language.
4. C++ is a language of few words.5. Almost every statement is terminated with
semicolon.6. C++ is statement-oriented language.7. Every C++ language program
has a extension .cpp or .cxx or .C8. Require explicit inclusion of related
header file.Advance Features of C++1. Classes and Objects.2. Derived Classes.3.
Private/public access control.4. Constructors and Destructors.5. Friend classes.
6. Inline function.7. Default argument.8. Overloading of operators..2Major Steps
In C++ Program DevelopmentC++ programs typically go through several phases to be
executed.ˆ Editing. The first phase consists of editing a file. This is
accomplished with an editor program. The programmertypes a C++ program with the
editor and makes the correction if necessary. The program is then often stored
onsecondary storage device such as a disk.ˆ Compile. In this phase the
programmer gives the command to compile the program. The compiler translates the
C++ program, into object code. In C++ system, a Preprocessor program executes
automatically before thecompilerˆs translation phase begins. The C++
preprocessor obeys special commands called preprocessordirectives which
indicates that certain manipulation usually are to be performed on the program
before thecompilation.ˆLinking. The file generated by the compiler is not a pure
executable file so it cannot be executed by the computedirectly. Rather special
program called the Linker is required that link the intermediate file with
library routinesstored in a files with the .lib extension. After linking the
intermediate file the linker generate the executable file(.exe) that can be
execute by computer.ˆ Executing After the successful compilation and linking of
program we receive the executable file that can beexecuted by the user.The
layout/Structure of C++ ProgramsThe general form of a C++ program is as follows
preprocessor directivesglobal declarationsclass definitionmain() {local
variables to function main ;statements associated with function main ;}
f1(){
local variables to function1 ;Statements associated with function1;}
f2(){local
variables to function f2 ;statements associated with function 2 ;}
BASIC
COMPONENTS OF C++ PROGAMVARIABLE Variable may be the most fundamental aspect of
any computer language. A variable is a space in thecomputerˆs memory set aside
for a certain kind of data and given a name for easy reference. Variables are
used so thatthe same space in memory can hold different values at different
times. Before using the variable it is necessary tocreate it with the proper
command.There are several issues associated with the variable:1. Name/Length of
variable (Naming rules).2. Type of variables.3. How to create.4. How to take
input and output in the variable.Name/Length of variable (Naming rules)ˆ First
character of the variable must be alphabet (a to z| A to Z) or underscore, while
the remaining may bedigits, alphabet or underscore.ˆ No blank is allowed within
a variable name.ˆ In some compiler the length of the variable is 8 characters,
some compilers allow variable names whoselength could be up to 40 or 256
character, but the latest compiler impose no restriction on the length ofthe
variable name.Example of Valid Variable Name:Age fname _abc _123 age123Example
of Invalid Variable Name:9num age$.3Type of variables While declaring the
variable it is necessary to specify its type.DATA TYPE DESCRIPTION SIZE RANGE
signed int Store integer values with nofractional part2 bytes -32768 to32768
unsigned int Store integer values with nofractional part2 bytes 0 to 65535singed
long Store large integer values with nofractional part4 bytes -2147483848to
2147483647unsigned longlongStore large integer values with nofractional part4
bytes 0 to4294967295float Store float value 4 bytes -3.4e38 to3.4e387 mantissa
double Store large float value 8bytes-1.7e308 to1.7e30815 mantissalong double
Store very large float value 10bytes-3.4e4932 to+1.1e493219 mantissachar Store
single quote enclosed withinthe quotes1 byte----Creating Variableˆ int age;ˆ int
age = 5;ˆ float profit = 78.56;ˆ char grade = ˆAˆ;ˆ int a,b,c;ˆ int a = 5, b =
7, c = 9;Displaying the content of VariableThe identifier cout is used for
displaying the value of variable and other messages. cout is actually an object.
It ispredefined in C++ to correspond to the standard output stream. A stream is
a system that refers to a flow of data. Thestandard output stream normally flows
to the screen display. With cout and operator << (insertion or put to operator)
is used. It directs the content of the variable on its right to the object on
its left. Necessary information about cout isincluded in iostream.h file.
Program1: Display the contents of the variable.# include <iostream.h>void
main(void){int a;a = 5;cout << a;}
Program2:# include <iostream.h>void main(void)
{int a;a = 5;cout << ˆvalue of a is ˆ;cout << a; // or cout << ˆvalue of a is ˆ
<< a;}
.4CONSTANTS Constant is an identifier having a value that cannot be during
the execution of program.Syntax:const type name = value;For instance:const float
g = 9.8;Example: Read mass and calculate the weight.# include <iostream.h>#
include <conio.h>void main(void){const float gravity = 9.8;float mass, weight;
cout << "Enter Mass : " ;cin >> mass;weight = mass * gravity;cout << "Calculated
Weight is " << weight;getch();}
In C++ constants can also be specified using the
preprocessor directive # define.Syntax:# define constant_name valueFor instance:
# define gravity 9.8The endl Manipulator endl manipulator causes a linefeed to
be inserted into the stream. Strictly speaking endl alsocauses the output buffer
to be flushed, but this happens invisibly.COMMENTS. Comments are an important
part of any program. They help the person writing the program andanyone who must
read the source file. The compiler ignores comments. So they do not add to the
executable file.Comments starts with a double slash // and terminate at the end
of line. C++ also support C language comments thatbegin with the /* and ends
with */.Taking Input In Variables:To read the data in variable, cin object is
used. The cin is predefined in C++ to correspond input stream. This streamdata
represent data coming from the keyboard. The >> is the extraction or get from
operator is used with cin object.Its takes the value from the stream objects on
its left and places it in the variable on its right.OPERATORSArithmetic
Operators.Assignment Operator.Relational Operators.Increment/Decrement Operators
Logical Operators / Boolean OperatorsArithmetic Operators Operators are symbols
that perform some particular action on operands.+ - * / %Program1 Read
temperature in Fahrenheit and Convert in into Celsius.# include <iostream.h>#
include <conio.h>void main(void){int farsen, cel;clrscr(); // associate header
file is conio.hcout << "Enter Temperature ";cin >> faren;cel = (faren ˆ 32) *
5 / 9;    or     f=(c*9/5)+32cout << "Equivalent Temperature In Celsius Is ˆ <<
cel;getch();}
.5Program1 Read three numeric values in int type variables using
one cin.# include <iostream.h># include <conio.h>void main(void){int n1,n2,n3;
clrscr(); // associate header file is conio.hcout << "Three Numeric Values ";cin
>> n1 >> n2 >> n3;clrscr();cout << "First Value is " << n1 << endl<< "Second
Value is " << n2 << endl<< "Third Value is " << n3;getch();}
.Arithmetic
Assignment Operator If we compare a C program with a program with a similar
purpose written inanother language, you may well find that the C source file is
shorter. One reason for this is that C has severaloperators that can compress
often-used programming such as the arithmetic assignment operators, which
combines anarithmetic operator, and an assignment operator and eliminates the
repeated operand.+= Addition Assignment operator-= Subtraction Assignment
 operator*= Multiplication Assignment operator/= Division Assignment operator%=
Remainder Assignment operatorFor instance:A = A + 1; can be written as A += 1;B
= B * 5; can be written as A *= 5;Increment & Decrement OperatorsIncrement and
decrement operators are used to add 1 or subtract 1 from the value of the
variable respectively.For instance:A = A +1; or A += 1; or A++; or ++A;A = A -1;
or A -= 1; or or A--; or --A;Increment and decrement operators can be used in
two ways:Prefix formPostfix formIn prefix form the operator precedes the
variable; and as a postfix, meaning that the operator follow the variable.
Example1:int A,B;A = 5;B = A++; /* B becomes 5 and A becomes 6 */Example2:int
A,B;A = 5;B = ++A; /* B becomes 6 and A becomes 6 */.6Relational Operators
Relational operators are the special type of operators used for comparing two
values.Relational operators are used with loops and decisions. These Constructs
require the program to ask questions aboutthe relationship between operands.
Relational Operator Meanings< Less than> Greater than<= Less than or equal to>=
Greater than or equal to== Equal to!= Not equal toExample:#include <iostream.h>#
include <conio.h>void main(void){int a,b;a = 5;b = 7;clrscr();cout << "A == B "
<< (a == b);cout << "nA > B " << (a > b);cout << "nA != B " << (a != b);
getch();}
Concept Of ManipulatorsProgram1# include <conio.h># include
<iostream.h>void main(void){int a =175;clrscr();cout << "Value of A Is" << a <<
"Only";getch();}
Program2# include <conio.h># include <iostream.h># include
<iomanip.h>void main(void){int a =175;clrscr();cout << "Value Of A is"<< setw(5)
<< a<< "Only"; // Output: Value of A is 175Onlyˆgetch();}
setw() Manipulator.
Manipulators are the operators used with insertion operator << for controlling
(modifying) theoutput generated by the C++ program. setw() is a manipulator that
specifies that the next value be printed in aspecified width, and the value will
be right justified in the field by default..7Program3# include <conio.h>#
include <iostream.h># include <iomanip.h>void main(void){int a =175;clrscr();
cout << "Value Of A is"<< setfill('#')<< setw(5) << a<< "Only";getch();}
setfill() Manipulator. setfill() manipulator takes a single character as an
argument and causes this character to besubstituted for spaces in the empty part
of the field.Program4# include <conio.h># include <iostream.h># include
<iomanip.h>void main(void){int a =175;clrscr();cout << "Value Of A is"<<
setiosflags(ios::left)<< setw(5) << a<< "Only";getch();}
setiosflags()
Manipulator. It is a manipulator by which we can justify text output the output.
Type CastingProgram# include <conio.h># include <iostream.h># include
<iomanip.h>void main(void){float num;int intpart;clrscr();cout << "Enter Float
Number : " ;cin >> num;intpart = (int) num;cout << "Integer Part is : " <<
intpart;cout << "nFractional Part is : " << setprecision(5)<< (num - intpart);
getch();}
.8Control Structure Any well-structured program is consist of three
structures:ˆ Sequence Structure.ˆ Selection/Conditional Structure.ˆ Repetition
Structure.Sequence Structure It is the simplest structure in which the
statements are executed in the order in which they areexecuted.
Conditional/Selection Structure Selection of one or multiple statements out of
several statements depending uponsome criteria is called selection structure. In
C++ language there are different types of conditional structures:1. if
structure.2. if else structure.3. switch structure.4. conditional operator.if
statement This is single selection structure used for selecting the single or
multiple statements if the definedcondition is hold, otherwise the statement(s)
is skipped, and the control is transfer to the next statement(s) of theprogram.
Syntax of an if statement is:if( condition )statementExample: Check the either
year is leap, if so display message ˆLEAP YEAR ˆ, otherwise doesnˆt display any
message.# include <conio.h># include <iostream.h>void main(void){int year;
clrscr();cout << ˆEnter Yearˆ;cin >> yearif (num % 2 == 0 )cout << ˆLEAP YEARˆ;}
Program: Write a program that read the data in five variables, and find the
largest value.# include <iostream.h># include <conio.h>void main(void){int
n1,n2,n3,n4,n5,large;clrscr();cout << "Enter First Number : "; cin >> n1;cout <<
"Enter Second Number : "; cin >> n2;cout << "Enter Third Number : "; cin >> n3;
cout << "Enter Forth Number : "; cin >> n4;cout << "Enter Fifth Number : "; cin
>> n5;large = n1;if (n2 > large) large = n2;if (n3 > large) large = n3;if (n4 >
large) large = n4;if (n5 > large) large = n5;cout << "Largest Value is " <<
large;getch();.9}
Program Read one numeric value (of 4 digits), and check either
the number is palindrome or not.# include <iostream.h># include <conio.h>void
main(void){int num,temp;int d4,d3,d2,d1;clrscr();cout << "Enter 4 Digit ";cin >>
num;temp = num;d4 = num % 10;num = (num-d4) / 10;d3 = num % 10;num = (num -
d3) / 10;d2 = num % 10;num = (num - d2) / 10;d1 = num ;num = temp;temp = d4 *
1000 + d3 * 100 + d2 * 10 + d1;if (num == temp)cout << "Number is Palindrome";
elsecout << "Number is Not Palindrome";getch();}
Nested if Statement If the
single selection structure ˆif statementˆ is written inside anther single
selection structurethen it is called nested single selection structure or nested
if structure. The internal if structure is totally dependedupon external loop.
For instance:if (condition){if (condition){}
}
Program# include <iostream.h>#
include <conio.h>void main(void){int num;clrscr();cout << "Enter Number ";cin >>
num;if (num >= 100){if (num <= 200){cout << "Number Lies Between 100 to 200";}
}
getch();}
.10Example: Check either the input character is capital alphabet (using
nested if)# include <conio.h># include <iostream.h>void main(void){char ch;
clrscr();cout << "Enter any character : ";ch = getch();if (ch >= 65 )if (ch <=
90)cout << "nCapital Alphabet is pressed!";}
isalpha() It is used to check an
ASCII character is alphabet or not.if ( isalpha(ch) ) cout << ˆInput Symbol is
Alphabet!ˆ;isdigit() It is used to check an ASCII character is digit or not.
isalnum() It is used to check an ASCII character is alphanumeric or not.
isupper() It is used to check an ASCII character is upper case or not.islower()
It is used to check an ASCII character is lower case or not.isspace() It is used
to check an ASCII character is punctuation or not.Necessary information for all
above macroˆs is included in ˆctype.hˆExample: Check either the input symbol is
alphabet or not (using isalpha() )# include <iostream.h># include <conio.h>#
include <ctype.h>void main(void){char ch;clrscr();cout << ˆEnter Character ˆ;ch
= getch();if ( isalpha(ch) )cout << ˆnInput Character is Alphabet ˆ;}
if else
statementIt is a double selection structure, used for executing the statement(s)
if the defined condition is satisfied, otherwiseanother block of statement(s)
will be executed.Syntax:if (condition)statementelsestatementorif (condition){
statement}
else{statement}
.11Example: Basic pay and grade is input from the
keyboard, write a program that calculate the net pay, afteradding bonus to the
basic pay. If the grade of employer is seventeen or above then the bonus is 500
otherwise the bonus is 300.void main(void){float bpay,npay,bonus;int grade;
clrscr();cout << "Enter Bpay ";cin >> bpay;cout << ˆEnter Ur Grade ˆ;cin >>
grade;if (grade >= 17)bonus = 500;elsebonus = 300;npay = bpay + bonus;
printf("nCalculated Pay is %f ", npay);getch(); }
else if statementThis
statement is used when the program has several blocks of statement(s) and we
want to execute one blockdepending upon some condition. If the first condition
is true then the statements following the first block will beexecuted, otherwise
the second block will be checked and if it is satisfied then the statements
following it will beexecuted otherwise the next condition will be checked in the
same way and some on.Syntax:if (condition){statement}
else if (condition){
statement}
else{statement}
Program Read one numeric value representing the speed
of a vehicle, and display the message, depending upon thespeed of the vehicle.#
include <iostream.h># include <conio.h>void main(void){int speed;clrscr();cout
<< "Enter Speed : ";cin >> speed;if (speed > 200 )cout << "Too Fast!";else if
(speed > 150)cout << "Quit Fast!";else if (speed > 100)cout << "Fast";else if
(speed > 50)cout << "Normal";elsecout << "Slow";getch(); }
.12Example: read the
data in two integer variables and one character variable, and perform the
arithmetic operation oninteger values, depending upon the value of character
variable.# include <iostream.h># include <conio.h>void main(void){int n1,n2;char
ch;clrscr();cout << "Enter First Number : ";cin >> n1;cout << "Enter First
Number : ";cin >> n2;cout << "Enter Operator : ";ch = getche();cout << endl;if
(ch == '+')cout << "Result is %d " << (n1 + n2);else if (ch == '-')cout <<
"Result is %d " << (n1 - n2);else if (ch == '*')cout << "Result is %d " << (n1 *
n2);else if (ch == '/')cout << "Result is %d " << (n1 / n2);elsecout << "Invalid
Value ";getch();}
LOGICAL OPERATORLogical operators are the special type of
operator use to condense and clarify the complicated selection structures aswell
as other constructions.Three main logical operators are:1 AND &&2 OR ||3 NOT !
AND It is a logical operator that based on the multiplication. It takes two
conditions and return true if both theconditions are true, if any of the
condition is false, then it return false.OR It is a logical operator that based
on addition.
 It takes two conditions, and return true if any of the condition istrue, if
both the conditions are false then it return false.NOT It is a logical that base
on the complement. It takes one expression, and negate (reverse) its value.
Example:NOT TRUE = FALSENOT FALSE = TRUE.13Example: Using OR operators# include
<iostream.h># include <conio.h>void main(void){int n1,n2;char ch;clrscr();cout
<< "Enter First Number : ";cin >> n1cout << "Enter First Number : ";cin >> n2;
cout << "Enter Operator + - * / : ";ch = getche();cout << endl;if (ch == '+')
cout << "Result is %d " << (n1 + n2);else if (ch == '-' || ch == ˆ_ˆ )cout <<
"Result is %d " << (n1 - n2);else if (ch == '*' || ch == ˆxˆ || ch == ˆXˆ)cout
<< "Result is %d " << (n1 * n2);else if (ch == '/' || ch == ˆˆ )cout <<
"Result is %d " << (n1 / n2);elsecout << "Invalid Value ";getch();}
Example:
Using AND operatorsvoid main(void){char ch;clrscr();printf("Enter Character :
");ch = getche();printf("n");if (ch >= 48 && ch <= 57)printf("Digit is
presses!");else if (ch >= 65 && ch <= 90)printf("Capital alphabet is pressed");
else if (ch >= 97 && ch <= 122)printf("Small alphabet is pressed");else
printf("Any other character is pressed!");getch();}
Example: Using NOT operators,
check either the input number is 1 or not# include <iostream.h># include
<conio.h>void main(void){int num;clrscr();cout << "Enter Number : ";cin >> num;
if (!(num == 1))cout << "Input Number is other than 1 ";elsecout << "Input
Number is 1";getch(); }
.14Switch StatementSwitch is a multiple selection
structure and it is similar to the else-if construct but has more flexibility
and a clearerformat.It is well structured, but can only be used in certain cases
where; Only one variable is tested; all branches must dependon the value of that
variable. The variable must be an integral type. (int, long, short or char).#
include <iostream.h># include <conio.h>void main(void){int num;clrscr();cout <<
"Enter Number : ";cin >> num;switch(num){case 1:cout << "One is pressed!";break;
case 2:cout << "Two is pressed!";break;case 3:cout << "Three is pressed!";break;
case 4:cout << "Four is pressed!";case 5:cout << "Five is pressed!";break;
default:printf("Any Other value is pressed!");}
getch();}
CONDITIONAL OPERATORIt
is the short form of if-else construct. The conditional operator is also some
times called the ternary operator sincethey take three arguments.Syntax:
expression1 ? expression2 : expression3if the expression 1 is true (that is if
its value is non zero), then the value returned will be expression2 otherwise
thevalue return will be expression3Example: Find largest value# include
<iostream.h># include <conio.h>void main(void){int num1, num2, large;clrscr();
cout << "Enter Number1 : ";cin >> num1;cout << "Enter Number2 : ";cin >> num2
large = (num1 > num2) ? num1 : num2;cout << "Largest Value is " << large;
getch();}
.15Example: Find the absolute value of an integer variable.# include
<iostream.h># include <conio.h>void main(void){int num, abs;clrscr();cout <<
"Enter Number : ";cin >> num;abs = (num < 0) ? num * -1 : num;cout << "Absolute
of ˆ << num << ˆ is ˆ << abs;getch();}
LOOP The default order of execution in a
C++ program is top-down. Execution starts at the beginning of the main()
functionand progresses, statement by statement, until the end of main() is
reached. However, this order is rarely encounteredin real C++ programs. The C++
language includes a variety of program control constructs that let you control
theorder of program execution, one of which is a loop structure.Loop is one of
the most important control structure uses for executing the statement(s) several
numbers of times.Loop is also called Iteration Structure.C++ gives you a choice
of three types of loopˆ for loopˆ while loopˆ do whilefor loop The for loop is
frequently used, usually where the loop will be traversed a fixed number of
times. A forstatement has the following structure:for ( initial; condition;
increment )statement;initial, condition, and increment are all C++ expressions,
and statement is a single or compound C++ statement. Whena for statement is
encountered during program execution, the following events occur:1. The
expression initial is evaluated. Initial is usually an assignment statement that
sets a variable to aparticular value.2. The expression condition is evaluated.
Condition is typically a relational expression.3. If condition evaluates to
false (that is, as zero), the for statement terminates, and execution passes to
the firststatement following statement.4. If condition evaluates to true (that
is, as nonzero), the C++ statement(s) in statement are executed.5. The
expression increment is evaluated, and execution returns to step 2.Example: Read
the integer number and find its factorial.# include <iostream.h># include
<conio.h>void main(void){int a, num, fact;clrscr();cout << "Enter Number : ";cin
>> num;fact = 1;for(a=1;a<=num;a++)fact = fact * a;cout << "Factorial of " <<
num << ˆ is ˆ << fact; getch();}
.16Example: Check either the input number is
prime or not.# include <iostream.h># include <conio.h>void main(void){int a,
num, div;clrscr();cout << "Enter Number : ";cin >> num;div = 0;for(a=1;a<=num;a+
+){if (num % a == 0)div = div + 1;}
if (div <= 2)cout << ˆPrime number" << num;
elsecout << ˆNot a prime number" << num;getch();}
break statementsWe often come
across situations where we want to jump out of a loop instantly, without to get
back to the conditionaltest. The keyword break allows us to do this. When the
keyword break is encountered inside any C++ loop, controlautomatically passes to
the first statement after the loop. A break is usually associated with an if
statement.Example: A program that the series of number 1 2 3 4 5# include
<iostream.h># include <conio.h>void main(void){int a;clrscr();for(a=1;a<=10;a++)
{cout << endl << a;if (a == 5) break;}
}
continue statementIn some programming
situations we want to take the control the beginning of the loop, bypassing the
statementsinside the loop, which have not yet been executed. The keyword
continue is encountered inside any C++ loop,control automatically passes to the
beginning of the loop. A continue is usually associated with an if statement.
Example: A program that the series of number 1 2 3 4 5 7 8 9 10# include
<iostream.h># include <conio.h>void main(void){int a;clrscr();for(a=1; a <= 10;
a++){if ( a = = 6 )continue;cout << a;}
}
.17Nested For Loop When the for loop is
written inside another for loop, then it is called nested for loop.Example: A
program that display the series of numbers1 2 3 4 5 6 7 8 9 102 4 6 8 10 12 14
16 18 203 6 ˆ 304 8 12ˆ 405 10 15ˆ 50# include <iostream.h># include <conio.h>#
include <iomanip.h>void main(void){int a, b;clrscr();for(a=1; a <= 5; a++){
for(b=1;b<=10;b++)cout << setw(5) << a*b;cout << endl;}
getch();}
Example: Display
the stars in diamond shape.# include <iostream.h># include <conio.h>void
main(void){int a, b;clrscr();for(a=1; a <= 20; a+= 2){gotoxy(40-a/2,2+a);
for(b=1;b<=a;b++)cout << "*";}
getch();}
while loop The while statement, It is
also called an unexpected condition loop used to executes a block of statements
as long as a specified condition is true. The while statement has the following
form:Syntax:While (condition) statementCondition is any C++ expression, and
statement is a single or compound C++ statement. When program executionreaches a
while statement, the following events occur:1. The expression condition is
evaluated.2. If condition evaluates to false (that is, zero), the while
statement terminates, and execution passes to the firststatement following
statement.3. If condition evaluates to true (that is, nonzero), the C++
statement(s) in statement are executed.4. Execution returns to step 1..18Example
A program that read the characters from the keyboard and display it in the
capital, and count how manyvowels characters are pressed.# include <iostream.h>#
include <conio.h># include <stdio.h># include <ctype.h>void main(void){char ch;
int total = 0;int vowels = 0;clrscr();cout << "Enter Text " << endl;while ((ch =
getch()) != 'r'){ch = toupper(ch);printf("%c", ch );if ( ch == 'A' || ch == 'E'
|| ch == 'I' || ch == 'O' || ch == 'U')vowels++;total++;}
cout << endl<< "Total
Character(s) " << total << endl<< "Vowels " << vowels;getch();}
Do while loop The
last of the three loop in C++ is the do-while loop. This loop is very similar to
the while loop- thedifference is the place where the condition is tested. The
while tests the condition before executing any of thestatements within the while
loop. Whereas do-while tests the condition after having executed the statements
within aloop.This means that do-while would execute its execution at least once,
even if the condition fails for the first time itself.The while, on the other
hand will not execute its execution if the conditions fails for the first time.
Syntax:do{}
while (condition);Example: Display the numbers 1 2 3 4 ˆ 10void
main(void){int a;a = 1;clrscr();do{printf("%dn",a);a++;}
while (a <= 10);
getch();}
.19Example Convert the decimal number into binary/octal/hexa numbers#
include <iostream.h># include <conio.h># include <stdio.h># include <ctype.h>#
include <iomanip.h>void main(void){int num=0; // Store Input Valuesint a; //
Counter Variableint base = 1; // Control the baseint temp; // Store the value
temporarilyint pos; // Control the position of binary outputchar ch; // Store
the input digitclrscr();gotoxy(20,3);cout << "Enter 4 Digits Number ";for(a=1 ;
a<=4 ; ){ch = getch(); // Take the input invisiblyif (!(isdigit(ch)) ) // Loop
 if input is not digitcontinue;gotoxy(50+a,3);printf("%c", ch); // display input
digitch = ch - 48; // convert digit into pure digitnum = num * base + ch; // Add
input digit with previous digitsbase = 10; // Set the base by 10temp = num;
gotoxy(4,5+a*2);printf("Decimal : %6d ",temp);printf(" Hexa : %6X ",temp);
printf(" Octal : %6o ",temp);printf(" Binary : ");pos = 75;do{int rem;rem = t
emp % 2 ;// display binary digitgotoxy(pos--,5+a * 2);printf("%1d", rem);temp =
(temp-rem) / 2;}
while (temp != 0);a++; // Add one in counter variable}
 // end of
the for loopgetch();}
.20Function A function is a named, independent section of
C++ code that performs a specific task and optionally returnsa value to the
calling program. Functions are easy to use; they allow complicated programs to
divide into smallblocks, each of which is easier to write, read, and maintain.
Functions are normally classified into two categories. Built in Functions..
Programmer Defined FunctionsBuilt in functions are those functions that are
already developed and available with the C++ compiler, standard headerfiles
store necessary information about these functions.Programmer defined functions
are those function that are developed by the programmer itself. Function can
acceptargument(s), as well as it can return one value to the calling program. As
far as the arguments and return value areconcerned we classify function in four
categories:. Simple function (No Argument, No Return).. Return Value function..
Argument function.. Return & Argument function.There are three elements involved
in using functions:. Function Prototype/ Declaration.. Function Definition..
Function CallFunction Prototype Function prototype is a single statement comes
before the main() function. Function prototypeprovides the following information
to the compiler. Function prototype always terminates with semicolon.. Name of
the function.. List and arrangement of argument(s) accepts by the functions.
Function can zero, one or morearguments..Specify either the function can return
any value to the calling program, function can return zero(no value) or one
value to the program.For Instance:void func1(void);Above line indicates that we
have declared a function ˆfunc1ˆ, that accept no value from the calling program;
as wellit will return no value to the calling program.void func2(int, float);
Above statement indicates that we have declare a function ˆfunc1ˆ, that accept
two values from the calling program,in which the first value is of type integer
and the second is of type float. Whereas it will returns no value to a calling
programfloat func3(int, float);Above statement indicates that we have declare a
function ˆfunc1ˆ, that accept two values from the calling program,in which the
first value is of type integer and the second is of type float. Whereas it will
returns one value of type float.Function Definition It is the actual block of
code that contains all statements, that will be execute, when the functionis
call. Function definition comes at the end of main() function. Function
definition is similar to the definition of themain() function.For instance:void
func1(void){ˆ}
Function Call It is statement that invokes the function. When the
function is invoked; it executes all the statementswritten inside the definition
of that function..21Simple Function A function that do not accept any value as
well as do not return any value.Example: A program that display the line of
stars.# include <iostream.h># include <conio.h>void line(void);void main(void)
{ clrscr();cout << ˆHello Worldˆ;line();cout << ˆHello Worldˆ;line();}
void
line(void){ int a;cout << endl;for(a=1;a<=80;a++)cout << ˆ*ˆ;}
Argument Functions
A function that accept the value(s).Example: A program that displays the line of
any character passed as argument.# include <iostream.h># include <conio.h>void
line(char);void main(void){ clrscr();cout << "Hello World"; line('*');cout <<
"University Of Balochistan"; line('+');}
void line(char ch){int a;cout << "n";
for(a=1;a<=80;a++)cout << ch;}
Example: A program that displays the line of any
character passed as argument, where the length of the line isalso specified as
an argument.# include <iostream.h># include <conio.h>void line(int, char);void
main(void){clrscr();cout << "Hello World";line(50,'*');cout << "University Of
Balochistan";line(70,'+');}
void line(int num, char ch){int a;cout << "n";
for(a=1;a<=num;a++)cout << ch;cout << "n";}
.22Argument & Return Function A
function that accept value(s) as well as return one value.Example: A function
that accepts two arguments and return the largest value.# include <iostream.h>#
include <conio.h>int findlarge(int, int);void main(void){int res, a = 27, b =
90;clrscr();res = findlarge(a,b);cout << "nLargest Value is " << res;}
int
findlarge(int num1,int num2){int temp;if (num1 > num2)temp = num1;elsetemp =
num2;return temp;}
Passing Arguments To FunctionsAn argument is a piece of data
passed from a program to the function. Arguments allow a function to operate
withdifferent values. In C++ the arguments can be passed to function in two
ways:ˆ Pass by value.ˆ Pass by reference.Pass By Value When the argument is pass
by value, a copy of the argumentˆs value is made and passed to the called
function. Changes to the copy do not affect the original variables in the
caller. This prevents the accidental sideeffects. Example:# include <conio.h>#
include <iostream.h>void change(int, int);void main(void){int a,b;a = 5;b = 7;
clrscr();cout << "A : " << a << " B : " << b;change(a,b);cout << "nA : " << a
<< " B : " << b;getch();}
void change(int a, int b){a = 15;b = 17;}
Pass By
Reference A reference provides an alias (different name) for a variable. When
the arguments are passed byreference, instead of a values being passed to the
function, a reference to the original is passed, with this feature thecaller
gives the called function to the ability to directly access the callerˆs data,
and to modify that data if the calledfunction so chooses. To indicate that a
function parameter is passed by reference, simply follow the parameterˆs typein
the function prototype by an ampersand (&) and use the same convention when
listing the parameters type in thefunction header..23Example: # include
<conio.h># include <iostream.h>void change(int&, int&);void main(void){ int a,b;
a = 5;b = 7;clrscr();cout << "A : " << a << " B : " << b;change(a,b);cout <<
"nA : " << a << " B : " << b;getch(); }
void change(int& a, int& b){ a = 15;b =
17;}
Default Argument FunctionsIn C++ a function can be called without specifying
all its arguments. For that purpose function definition mustprovide default
values for those arguments that are not specified. If one argument is missing
when the function iscalled, it is assumed to be last argument. In case of
multiple arguments they must be the trailing arguments.Example:# include
<conio.h># include <iostream.h>void display(int=10 , int =20, int=30 );void
main(void){clrscr();display(60,70,80); // show 60 70 80display(100,200); // show
100 200 30display(300); // show 300 20 30display(); // show 10 20 30getch();}
void display(int a, int b, int c){ cout << endl << "A : " << a << " B : " << b
<< " C : " << c;}
Inline FunctionImplementing a program as a set of functions is
good from a software-engineering standpoint, but function callinvolve execution
time overhead. C++ provides inline functions to help reduce function call
overhead (specially forsmall functions). The qualifier inline before a function
returns type in the function definition advices the compiler togenerate a copy
of the functions code in place (when appropriate) to avoid a function call. The
tradeoff is thatmultiple copies of the function code are inserted in the program
rather than having a single copy of the function towhich control is passed each
time the function is called. The compiler can ignore the inline qualifier and
typicallydoes so for all but the smallest functions.Example: # include <conio.h>
# include <iostream.h>inline int cube(int n){ return n * n * n;}
void main(void){
int num,res;clrscr();cout << "Enter Number : " ;cin >> num;res = cube(num);cout
<< "Result is : " << res;getch(); }
.24Overloaded FunctionsC++ enables several
functions of the same name to be defined as long as these functions have
different sets ofparameters. This capability is called function overloading.
When an overloaded function is called, the C++ compilerselects the proper
function by examining the number, types and order of the arguments in the call.
Functionoverloading is commonly used to create several functions of the same
name that perform similar tasks, but ondifferent data types. Overload functions
are distinguished by their signatures (a signature is a combination of afunction
name and its parameter types). The function encodes each function identifier
with the number and the typesof its parameter (sometimes referred to as name
mangling or name decoration) to enable type-safety linkage. Typesafe linkage
ensures that the proper overload function is called.Example:# include <conio.h>#
include <iostream.h>void line(void);void line(char);void line(char, int);void
main(void){clrscr();line();line('+');line('#',70);getch();}
void line(void){int
a;cout << endl;for(a=1;a<=80;a++)cout << "*";}
void line(char ch){int a;cout <<
endl;for(a=1;a<=80;a++)cout << ch;}
void line(char ch, int num){int a;cout <<
endl;for(a=1;a<=num;a++)cout << ch;}
Variables and Storage ClassesThe storage
class of a variable determines which parts of the program can access it and how
long it stays in existence.As far as storage classes are concerned, the
variables
 are classified in three main categories:ˆ Automatic variables.ˆ External
variables.ˆ Static variables..25Automatic Variables. Variables defined within a
function body are called automatic variables or local variables. Akeyword auto
can be used to specify an automatic variable.void main(void){auto int age;auto
float fee;}
The word auto is rarely used since this is the default.Lifetime An
automatic variable is no created until the function in which it is defined is
called. When the control istransferred to the function, then all its containing
variables are created and memory space is set aside for them, laterwhen the
called function is terminated the control is return back to the calling program,
the variables are destroyedand their values are lost.The time period between the
creation and destruction of a variable is called its lifetime (duration). The
lifetime if anautomatic variable coincides with the time when the function in
which it is defined is executing. The idea behindlimiting lifetime of variables
is to save memory space. If a function is not executing, the variables it uses
duringexecution are presumably not needed. Removing them free up memory that can
be used by other functions.Visibility A variables visibility describes the
locations within a program from which it can be accessed. It can bereferred to
in statements in some parts of the program, but in others attempts to access it
lead to an unknown variableerror message. The word scope is also used to
describe visibility. The scope of a variable is that part of the programwhere
the variable is visible. Automatic variables are only visible within the
function in which they are defined.# include <iostream.h># include <conio.h>void
fun1(void);void main(void){int b = 5;fun1();}
void fun1(void){int a = 7;cout <<
ˆA : ˆ << a;cout << endl << ˆB : ˆ << b;}
Initialization When an automatic
variable is created, the compiler does not try to initialize it. Thus it will
start off withan arbitrary value, which may be 0 but probably will be something
else. If we want it initialized, you must do itexplicitly.int a = 45;Example:#
include <iostream.h>void main(void){int a;cout << ˆA : ˆ << a; // Any garbage
value}
.26External Variables. External variable is a major storage and defined
outside any function. An external function isvisible to all the functions in a
program. External variables are also called global variables, since they are
known byall the functions in a program.If external variable is not initialized
explicitly then it is initialized automatically to 0 when it is created. The
externalexist for the life of the program and visible int the file in which they
are defined, starting at the point where they aredefined.Example: # include
<iostream.h># include <conio.h>int data;void fun1(void);void fun2(void);void
fun3(void);void fun4(void);void main(void){clrscr();fun1(); // display 0
fun2(); // display 4fun3(); // display 20fun4(); // display 5cout << endl <<
"Data is " << data; // display 5getch();}
void fun1(void){cout << endl << "Data
is " << data;data++;}
void fun2(void){data += 3;cout << endl << "Data is " <<
data;data++;}
void fun3(void){int data=20;cout << endl << "Data is " << data;
data++;}
void fun4(void){int data=20;cout << endl << "Data is " << ::data;data++;
}
.27Static Variables. A static variable has the visibility of a local variable;
its lifetime is similar to that of an externalvariable, except that it does not
come into existence until the first call to the function containing it.
Thereafter itremains in existence for the life of the program. The static
variable is initialized only once-the first time their functionis called. They
are not called on subsequent calls to the function as ordinary automatic
variables are.Example: Normal variables initialization.# include <iostream.h>#
include <conio.h>void fun(int);void main(void){clrscr();fun(5); // display 5
fun(7); // display 7getch();void fun(int a){int res=0;res = res + a;cout << endl
<< "Result is : " << res;}
Example:# include <iostream.h># include <conio.h>int
data;void fun(int);void main(void){clrscr();fun(5); // display 5fun(7); //
display 12getch();}
void fun(int a){static int res=0;res = res + a;cout << endl
<< "Result is : " << res;}
.28Object Oriented Programming (Object and Class )OOP
is relatively a new programming technique, in which the program is developed in
the form of an object.ˆ Any real word entity is called an object.ˆ Anything
having some properties (attributes) and functions (purposes) is called an
object. By such definition wecan say that every thing in this universe is an
object.For Example: Cup is an object.Cup has several properties:1. Color.2.
Cost.3. Width.4. Height.5. Weight6. Material from which it is developed
(Plastic, Marble).7. Design.8. Company.Cup has a several functions:1. Use for
drinking tea.2. Use for drinking coffee.3. Use for drinking cold drinks.4. Use
for shave.5. Use for washing car.6. Use as a decoration piece.ˆ Object is an
encapsulation of data and other related routines. Placing data and functions
together into a singleentity is the central idea of object-oriented programming.
Objects are defined using a special structure called theclass. A class is a
template used to define the structure of an object. A class is a user defined
data type. Conceptof object-oriented programming was introduced to implement the
information hiding. An object has the samerelationship to a class that a
variable has to a data type. An object is said to be an instance of a class.
Specifying & Using ClassProgram# include <iostream.h># include <conio.h>class
student{private: int rno;int age;float fee;public:void assign_values(int mrno,
int mage, float mfee){rno = mrno;age = mage;fee = mfee;}
void get_input(void){
cout << endl << "Enter RNo : ";cin >> rno;cout << "Enter Age : ";cin >> age;cout
<< "Enter Fee : ";cin >> fee;}
void display(void){cout << endl<< "Rno : " << rno
<< "Age : " << age<< "Fee : " << fee;}
.29}
;void main(void){student s1,s2,s3;
s1.assign_values(10,20,70.0);s2.get_input();s3.get_input();s1.display();
s2.display();s3.display();getch(); }
Members of Class (Data & Functions)The class
declaration starts with the keyword class, followed by the class name. The body
of the class is delimited bybraces and terminated by semicolon. The class has
two members:ˆ Data Member(s).ˆ Member Functions.The data items within a class
are called data members (or sometimes called member data). There can be any
numberof data members in a class. Functions that are included within a class are
called Member Functions. Some languagessuch as Smalltalk the member functions
are called methods. Some languages refer to calls to member functions as
messages.private and publicA key feature of object-oriented programming is data
hiding. Private data and functions can only be accessed fromwithin a class.
Pubic data or functions on the other hand are accessible from outside the class.
Accessing Members of ClassMembers of a class are accessed using the member
access operators (the dot operator) and the arrow operator (->).The dot operator
accesses a class member via the variable name for the object or via a reference
to the object. Thearrow operator consisting of a minus sign (-) and greater than
sign (>) with no intervening spaces- accesses a classmember via a pointer to the
object.Member Functions Outside The ClassIn C++ it is allowed to define the
Member function of the class outside its definition.Program# include
<iostream.h># include <conio.h>class employee{private: int empid;int grade;int
pay;public:void assign (int mempid, int mgrade, int mpay);void display(void);}
;
void employee::assign(int mempid, int mgrade, int mpay){ empid = mempid;grade =
mgrade;pay = mpay;}
void employee::display(void){ cout << endl << "Employee ID :
" << empid<< endl << "Grade : " << grade<< endl << "Pay " << pay; }
void
main(void){ employee e1, e2;clrscr();e1.assign(10,17,10000);
e2.assign(20,18,15000);e1.display();e2.display();getch(); }
.30Constructors When
a class object its members can be initialized automatically without a separate
call to a memberfunction. Automatic initialization is carried out using a
special member function called a constructor. A constructor isa class member
function with the same name as the class that is executed automatically whenever
an object is created.Constructors cannot return any value.Example:# include
<iostream.h># include <conio.h>void main(void){class customer{private:int cno;
public:customer() // customer(): cno(0) { }
{cno = 0;}
void show(){cout << endl <<
"Counter Is " << cno;}
}
;customer c1;clrscr();c1.show();getch();}
Overloaded
Constructors In C++ it is possible to overload the constructor to provide a
variety of means forinitializing objects.Example: # include <iostream.h>#
include <conio.h>void main(void){class customer{private:int cno;public:
customer(){cno = 0;}
customer(int temp){cno = temp;}
void show(){ cout << endl <<
"Counter Is " << cno;}
}
;customer c1;customer c2(21);clrscr();c1.show();
c2.show();getch(); }
.31Objects As Arguments Objects can be passed to the
functions as the arguments.Example:# include <iostream.h>include <conio.h>void
main(void){class income{private:int amount;public:income(){amount = 0;}
income(int a){amount = a ;}
void assign(int a){amount = a;}
void show(){cout <<
endl << "Amount Is " << amount;}
void add(income i1, income i2){amount =
i1.amount + i2.amount;}
}
;income d1;income d2(100);income d3;d3.assign(73);income
d4;d4.add(d2,d3);clrscr();d4.show();getch();}
.32Default Copy Constructors In C++
it is possible to initialize an
 object with another object of the same type, and wedonˆt need to create a
special constructor for this; since it is already built into all classes and
known as default copyconstructor.Example:# include <iostream.h># include
<conio.h>void main(void){class biodata{private:int recno;int age;float pay;
public:biodata(){recno = 0;age = 0;pay = 0.0;}
biodata(int r, int a, float p){
recno = r;age = a;pay = p;}
void display(){cout << endl << "Record No# " << recno
<< endl << "Age " << age<< endl << "Pay " << pay<< endl;}
}
;biodata
s1(10,25,12000);biodata s2(s1);biodata s3 = s1;clrscr();s1.display();
s2.display();s3.display();getch();}
.33Destructors A destructor is a special
member function of class. The name of the destructor for a class is the tilde
(~)character followed by the class name. The destructor is the complement of the
constructors. A classˆs destructor iscalled when an object is destroyed. The
destructor does not actually destroy the object-it performs termination
housekeeping before the system reclaims the objectˆs memory so that memory may
be reused to new objects.A destructor receives no parameters and returns no
value. A class may have only one destructor- destructoroverloading is not
allowed.Example: # include <iostream.h># include <conio.h>class myclass{private:
int rno;public: myclass(void){cout << endl << "Constructor With No Arguments Is
Called";}
myclass(int a){rno = a;cout << endl << "Constructor With One Argument
Is Called"; }
~myclass(){cout << endl << "One Object Is Destroying"; }
 }
;void
main(void){ clrscr();Myclass o1;Myclass o2(1);getch(); }
Returning Objects From
Functions In C++ it is possible to define a function that can return a value.
Example: # include <iostream.h># include <conio.h>class my class{private int
amount;public: myclass(void){amount = 0; }
myclass(int a){amount = a; }
myclass
addvalues(myclass o1){ myclass temp;temp.amount = amount + o1.amount;return
temp;}
void display(void){cout << endl << "Value of Amount is " << amount ;}
}
;
void main(void){ clrscr();myclass o1(10);myclass o2(20);myclass o3;o3 =
o1.addvalues(o2);o1.display();o2.display();o3.display();getch();}
.34Static Class
Data Each object contains its own separate data, if a data item in a class is
declared as static, then onlyone such is created for the entire class, no matter
how many objects there are. A static data item is useful when allobjects of the
same class must share a common item of information.Example: # include
<iostream.h># include <conio.h>class myclass{private: static int count;public:
myclass(void){count++;}
void display(void){cout << endl << "Value of Count is "
<< count ;}
}
;int myclass::count=0;void main(void){clrscr();myclass o1;myclass
o2;myclass o3;o1.display();o2.display();o3.display();getch();}
Example:# include
<iostream.h># include <conio.h>class myclass{private: int sno;static int count;
public: myclass(void){count++;sno = count;}
void display(void){cout << endl <<
"Value of SNo is " << sno ;}
}
;int myclass::count=0;void main(void){clrscr();
myclass o1;myclass o2;myclass o3;o1.display();o2.display();o3.display();getch();
}
.35ARRAYSArray is a data structure generally used for storing the large number
of values having same type.i) Array is a set of finite, fixed and homogenous
elements.ii) In array the multiple values are stored with single name reference,
but a special integer number called theindex/subscript is used for referring the
particular element of an array.iii) In C++ an array indexing starts at position
0. The elements of the array occupy adjacent locations in memory.iv) By using
the array in a program it is necessary to declare it with the proper command.One
Dimension Array An array whose each element is referred by a single array is
known as one dimension array.Array Definition Like other variables, the array
needs to be defined, so the compiler will know what kind ofarray, and how long
an array, we want.Syntax: datatype arrayname[size];Example: int data[10];Here
the int specifies the type of variable, just as it does with simple variables,
andthe word data is the name of the array variable.The [10] tells the how many
variables of type int will be in our array. Each ofseparate variables in the
array is called an ˆelementˆ. The bracket tells the compilerthat we are dealing
with an array.Referring to Individual Elements of the Array Once the array has
been established, we need a way to referto its individual elements. This is done
with subscripts, the number in bracket following the array nameSyntax:
arrayname[element];Example:Data[5] = 26;Entering Data into the ArrayMethod1#
include <iostream.h># include <conio.h>void main(void){ int temp[7];int avg;
clrscr();cout << "Enter Temperature for Day 1 " ; cin >> temp[0];cout << "Enter
Temperature for Day 2 " ; cin >> temp[1];cout << "Enter Temperature for Day 3
" ; cin >> temp[2];cout << "Enter Temperature for Day 4 " ; cin >> temp[3];cout
<< "Enter Temperature for Day 5 " ; cin >> temp[4];cout << "Enter Temperature
for Day 6 " ; cin >> temp[5];cout << "Enter Temperature for Day 7 " ; cin >>
temp[6];avg = temp[0] + temp[1] + temp[2] + temp[3] + temp[4] + temp[5] +
temp[6];avg = avg / 7;cout << "Average Temperature is " << avg;getch();}
Method2
# include <iostream.h># include <conio.h>void main(void){int temp[7];int avg;
clrscr();for(int a =0;a<=6;a++){ cout << "Enter Temperature for Day 1 " ;cin >>
temp[a];}
avg = 0;for(a=0;a<=6;a++)avg += temp[a];avg = avg / 7;cout << "Average
Temperature is " << avg;getch();}
.36Program Find the largest value from the
array.# include <iostream.h># include <conio.h>void main(void){int data[10];int
large;clrscr();for(int a =0;a<=9;a++){cout << "Enter Temperature for Day 1 " ;
cin >> data[a];}
large = data[a];for(a=0;a<=9;a++)if (data[a] > large)large =
data[a];cout << "Largest is " << large;getch();}
Program Reverse the elements of
the array# include <iostream.h># include <conio.h>void main(void){int data[10];
int a, temp;clrscr();for(a =0;a<=9;a++){cout << "Enter Temperature for Day 1 " ;
cin >> data[a];}
clrscr();cout << "Before Reverse" << endl ;for(a=0;a<=9;a++)cout
<< "Data " << a << " is " << data[a] << endl ;// Interchange the array elements
for(a=0;a<=4;a++){temp = data[a];data[a] = data[9-a];data[9-a] = temp;}
cout <<
endl << "After Reverse" << endl ;for(a=0;a<=9;a++)cout << "Data " << a << " is "
<< data[a] << endl;getch();}
Initializing Arrays In C++ language it is possible
to assign the values to the elements of an array.Syntax:¾ datatype
arrayname[size] = {value1, value2, value3ˆ valuen}
;For instance:int data[5] =
{11,22,33,14,51}
;int data[5] = {0}
; // all the elements are initialized with a
value 0Example:int data[5] = {10,40,30,5,11}
;.37Program Calculates the frequency
of the numbers (varies from 0 to 9) input from the keyboard# include
<iostream.h># include <conio.h># include <iomanip.h>void main(){ int data[20] =
{0}
;int frequency[10] = {0}
;int a;clrscr();for(a=0;a<=19;a++){cout << "Enter
Data (0-9) " ;cin >> data[a] ;}
for(a=0;a<=19;a++){++frequency[data[a]];}
clrscr();cout << endl << endl<< setw(20) << "Data"<< setw(20) << "Frequency"<<
endl;for(a=0;a<=9;a++){cout << setw(20) << a<< setw(20) << frequency[a]<<
endl; }
getch();}
Selection Sort Selection sort is one of the easiest way to sort
the data. The basic idea of the selection sort is to findthe smallest element in
the array and move it to the first position, then find the next smallest element
and move it tothe second position, and continue this process until the next to
the last position is filled. When the correct element isin the next to the last
position, the sort is finished because the last element, which is the only one
left, must be thelargest element.Program for selection sort# include
<iostream.h># include <conio.h>void main(void){ int data[10];int a,b, index,
temp;clrscr();for(a =0;a <= 9; a++){cout << "Enter Data " << a << " : ";cin >>
data[a]; }
for( a = 0 ; a <= 8 ; a++){index = a ;temp = data[a];for( b = a + 1; b
<= 9 ; b++){ if ( temp > data[b]){ temp = data[b];index = b;}
 }
data[index] =
data[a];data[a] = temp; }
clrscr();for(a=0;a<=9;a++)cout << "nData " << a << "
is " << data[a];getch();}
.38Passing Arrays To Functions To pass an array
argument to a function; specify the name of the array without anybrackets.#
include <iostream.h># include <conio.h>void input(int [], int n );void
display(int [], int n);void main(void){int data[10];input(data,10);display(data,
10);getch();}
void input(int array[], int size){clrscr();for(int a=0; a<size; a+
+){cout << "Enter Data " << a << " : " ;cin >> array[a];}
}
void display(int
array[], int size){clrscr();for(int a=0; a<size; a++)cout << "Data " << a << "
is " << array[a] << endl ;}
Program Generates the frequency table.# include
<iostream.h># include <conio.h># include <iomanip.h>void main(){int data[20] =
{0}
;int frequency[10] = {0}
;int a;clrscr();for(a=0;a<=19;a++){cout << "Enter
Data (0-9) " ;cin >> data[a] ;}
for(a=0;a<=19;a++){++frequency[data[a]];}
clrscr();cout << endl << endl<< setw(20) << "Data"<< setw(20) << "Frequency"<<
endl;for(a=0;a<=9;a++){cout << setw(20) << a<< setw(20) << frequency[a]<< endl;}
getch();}
.39String The way a group of integers can be stored in an integer
array, similarly a group of characters can be stored in acharacter array. In C++
language an array of characters is called a string. Programming languages to
manipulate textsuch as words and sentences uses character arrays or strings.
String constantcout << ˆHelloˆ;ˆHelloˆ is a string constant. That means the
string itself is stored someplace in memory,
 but that it cannot bechanged. Each character occupies one byte of memory, and
the last character of the string is the character ˆ0ˆcalled the null character,
which indicates the end of the string.String Variable# include <conio.h>#
include <iostream.h>void main(void){char name[30];cout << ˆEnter Name : ˆ;cin >>
name;cout << endl << ˆInput Name is ˆ << name;getch();}
Note: The extraction
operator >> uses any white space character to terminate entry of variable. So
there is no way toenter a multiword string into a single array using >>Note:
C/C++ does not support bound checking features.Avoiding Buffer Overflow In C++
there is no built in mechanism to keep a program from inserting array elements
outside an array, but we can use the >> operator to limit the number of
characters it places in an array.# include <conio.h># include <iostream.h>#
include <iomanip.h>void main(void){char name[30];cout << ˆEnter Name : ˆ;cin >>
setw(30) >> name;cout << endl << ˆInput Name is ˆ << name;getch();}
Reading
Embedded Blanks cin.get() This member function allows to read text containing
blanks.Syntax:cin.get(string_variable, MAX);Example:# include <conio.h># include
<iostream.h>void main(void){char name[10];clrscr();cout << "Enter Name ";
cin.get(name,10);clrscr();cout << endl << "Name is " << name;getch();}
.40Reading
Multiple Lines By using the third argument with cin.get() function, we can enter
a string multiple lines.This argument specifies the character that tells the
function to stop reading. The default value for this function is thenewline (
ˆnˆ) character by the default value can be override by the specified character.
# include <conio.h># include <iostream.h>void main(void){ char text[10];
clrscr();cout << "Enter Text ";cin.get(text,10, ˆ#ˆ);clrscr();cout << endl <<
"Text is " << text;getch();}
String Functionsstrlen() Use strlen to find the
length of the a string in bytes, not counting the terminating null character.
Itsassociated header file is string.hExample:# include <conio.h># include
<iostream.h># include <string.h>void main(void){ char name[25];int len;clrscr();
cout << ˆEnter Name : ˆ;cin.get(name.25);len = strlen(name);cout << ˆnLength of
ˆ << name << ˆ is ˆ << len; }
strcpy() Use strcpy to copy one string to another.
Its associated header file is string.hSyntax:strcpy(string1, string2); /* Copy
string2 to string1 */Example:void main(void){ static char s1[10] = ˆHelloˆ;char
s2[10];strcpy(s2,s1); }
strcmpi() Use strcmpi() to compare strings and return an
integer value.Syntax: strcmpi(string1, string2);The return value is zero if the
two strings are identical. If string1 is less than sting2, the return value is
lessthan zero, when string1 is greater than string2; it returns an integer value
greater than zero, where thecomparison is case sensitive. Its associated header
file string.hExample: Check whether 2 input strings are equal or not.# include
<conio.h># include <iostream.h># include <string.h>void main(void){ char
text1[25];char text2[25];int res;clrscr();cout << "Enter Text1 ";
cin.get(text1,25);cout << "Enter Text2 ";cin.get(text2,25);res =
strcmpi(text1,text2);if ( res == 0 )cout << ˆStrings R Equalˆ;elsecout <<
ˆStrings R Not Equalˆ;getch(); }
.41strupr() Use to convert any lowercase letters
in a string to uppercase, other characters in the strings are unaffected.Its
associated header is string.hSyntax:strupr(string);Example:void main(void){
static char text[25] = ˆhello worldˆ;strupr(tex);}
strlwr() Use to convert any
uppercase letters in a string to lowercase, other characters in the strings are
unaffected.Its associated header file is string.hSyntax:strlwr(string);Example:
void main(void){static char text[25] = ˆhello worldˆ;strlwr(text);}
strrev() Use
strrev() to reverse the order of the characters in string. The terminating null
character remains at thesame place. strrev() is normally used to check whether a
string in palindrome. Its associated header file isstring.hSyntax:
strrev(string);Example: Check either the input string is palindrome on not.#
include <conio.h># include <iostream.h># include <string.h>void main(void){char
text1[25];char text2[25];clrscr();cout << "Enter Text ";cin.get (text1,25);
strcpy(text2,text1);strrev(text2);if ( strcmpi(text1,text2) == 0 )cout <<
ˆString Is Palindromeˆ;elsecout << ˆString is Not Palindrome";getch();}
strcat()
Use strcat to concatenate (append) one string to another. Its associated header
file is string.hSyntax:strcat(string1, strzing2);Example:void main(void){char
first[10] = ˆkaraˆ;char second[5] = ˆchiˆ;strcat(first,second); /* concatenate
second with first */}
.42Two Dimension Arrays: Two-dimension array (matrix) is an
array whose each element is itself an array. In two-dimensionarray each element
is referred by two index values, in which one represent the row position and the
secondrepresent column position.Syntax for creating two-dimension arraydatatype
arrayname[rows][columns];For instance:int data[3][4];Referring to Individual
Elements of the 2D Array Once the array has been established, we need a way to
refer toits individual elements. This is done with subscripts, the numbers in
brackets following the array nameSyntax:arrayname[rowposition][columnposition];
Example:data[2][3] = 26;Method1: Entering data in 2D Array# include <iostream.h>
# include <conio.h>void main(void){int data[2][3];cout << "Enter Data "; cin >>
data[0][0];cout << "Enter Data "; cin >> data[0][1];cout << "Enter Data "; cin
>> data[0][2];cout << "Enter Data "; cin >> data[1][0];cout << "Enter Data ";
cin >> data[1][1];cout << "Enter Data "; cin >> data[1][2];}
Method2: Entering
data in 2D Array# include <iostream.h># include <conio.h># include <iomanip.h>
void main(void){int data[2][3];int a,b;clrscr();for(a=0;a<=1;a++){
for(b=0;b<=2;b++){cout << "Enter Data ";cin >> data[a][b];}
}
clrscr();
for(a=0;a<=1;a++){for(b=0;b<=2;b++)cout << setw(5) << data[a][b];cout << endl ;}
getch();}
.43Program Calculates the sum of rows and columns of 2-dimension array.
# include <iostream.h># include <conio.h># include <iomanip.h>void main(void){
int data[5][5];int a,b;int tr, total;int tc;clrscr();for(a=0;a<=4;a++){
for(b=0;b<=4;b++){cout << "Enter Data ";cin >> data[a][b];}
}
clrscr();//display
and addtotal = 0;for(a=0;a<=4;a++){tr = 0;for(b=0;b<=4;b++){cout << setw(5) <<
data[a][b];tr = tr + data[a][b];}
cout << setw(5) << tr;cout << endl ;total =
total + tr;}
for(a=0;a<=4;a++){tc = 0;for(b=0;b<=4;b++)tc = tc + data[b][a];cout
<< setw(5) << tc;}
cout << setw(5) << total ;getch();}
.44Arrays As Class Member
Data# include <iostream.h># include <conio.h># include <iomanip.h>class
shopping_mall{private:int shops[50];public:void assign(int income,int shop){
shops[shop] = income;}
void display(int shop){cout << endl << "Income of a Shop "
<< shop << " is " << shops[shop] ;}
}
;void main(void){ shopping_mall plaza1;
shopping_mall plaza2;int a;clrscr();for( a=0;a<=49;a++)plaza1.assign(-1,a);
for( a=0;a<=50;a++)plaza1.assign(-1,a);plaza1.assign(500,25);
plaza1.assign(5000,15);plaza2.assign(2000,10);plaza2.display(10);
plaza1.display(15);getch();}
Array of Objects# include <conio.h># include
<iostream.h># include <iomanip.h>class biodata{private: int rno;float fee;
public: biodata(void){ rno = 0;fee = 0.0;}
void assign(int r, float f){ rno = r;
fee = f;}
void input(void){ cout << endl << "Enter RNO : "; cin >> rno;cout <<
"Enter Fee : "; cin >> fee;}
void display(void){cout << endl << "Roll No# " <<
setw(5) << rno << " Fee : " << fee;}
}
;.45void main(void){biodata s1[20];int a;
s1[0].assign(10,500);clrscr();for(a=1;a<=19;a++){s1[a].input();}
 clrscr();
for(a=0;a<=19;a++)s1[a].display();}
Operator Overloading. Operator is a Sequence
of symbols that define a certain operation on the data.Introduction What is
Operator Overloadingˆ It is one of a most powerful feature of C++.ˆ Operator
overloading is the straightforward and natural way to extend the C++.ˆ Normally
the C++ operators can only be used with built in data types; however it is
possible to enable the C++operators to work with user defined data type (class
objects) by a process called an operator overloading.ˆ Operator overloading is
most appropriate for mathematical classes.ˆ Operator overloading is not
automatic, however; the programmer must write operator-overloading functions to
perform the desired operations.ˆ Operator overloading function is like the
normal function except that the function name is a keyword followed bythe symbol
for the operator being overload.Advantages ˆOperator overloading contributes to
C++ extensibility, one of the languageˆs most appealing attributes.ˆ Correct use
of operator overloading makes a program clearer than accomplishing the same
operations withexplicit function calls.Disadvantage ˆInconsistent use of
operator overloading make a program cryptic and difficult to read.Limitation of
Operator Overloadingˆ Operator overloading cannot change the precedence of an
operator.ˆ Overloading cannot change the associativity of an operator.ˆ It is
not possible to change the ˆarityˆ of an operator (i.e., the number of operands
an operators takes). Overloadedunary operators remain as unary operators,
overloaded binary operators remain as binary operators.ˆ Ternary operator
( ? : ) cannot be overloaded.ˆ It is not possible to create new operators: only
existing operators can be overload.ˆ Operator overloading works with objects of
user-defined types or a mixture of an object of a user-defined typeand an object
of a built in type..46Overloading Unary Operators.Program Prefix (But doesnˆt
allow assignment i.e., a = ++b)# include <iostream.h>#
 include <conio.h>class myclass{private: int count;public: myclass(void){count =
0;}
myclass(int c){count = c;}
void display(void){cout << endl << "Count is " <<
count;}
void operator ++ () // Increment Prefix{count++;}
}
;void main(void)
{ myclass o1;myclass o2(5);clrscr();++o1;o1.display(); // Display 1o2.display();
// Display 5++o2;++o2;o2.display(); // Display 7getch(); }
Program Prefix (Allows
assignment i.e., a = ++b)# include <iostream.h># include <conio.h>class myclass{
private: int count;public: myclass(void){count = 0;}
myclass(int c){count = c;}
void display(void){cout << endl << "Count is " << count;}
myclass operator ++
() // Increment Prefix with assignment ability{ count++;myclass temp;temp.count
= count;return temp;}
}
;.47void main(void){myclass o1;myclass o2;clrscr();++o1;o2
= ++o1;o1.display(); // Display 2o2.display(); // Display 2getch();}
Program
Overloading of unary operator (prefix/postfix) with assignments# include
<iostream.h># include <conio.h>class myclass{private: int count;public:
myclass(void){count = 0;}
myclass(int c){count = c;}
void display(void){cout <<
endl << "Count is " << count;}
myclass operator ++ () // Increment Prefix with
assignment ability{count++;myclass temp;temp.count = count;return temp;}
myclass
operator ++ (int) // Increment PostFix with assignment ability{myclass
temp(count);count++;return temp;}
}
;void main(void){myclass o1;myclass o2(10);
myclass o3;myclass o4;++o1; // 1o3 = ++o1; // o3 = 2, o1 = 2o2++; // 11o4 = o2+
+; // o4 = 11, o2 = 12clrscr();o1.display(); // Display 2o2.display(); //
Display 12o3.display(); // Display 2o4.display(); // Display 11getch();}
.48
Overloading Binary OperatorsProgram: Overloading + operator# include
<iostream.h># include <conio.h>class totalwork{private:int months;int days;
public:totalwork(){months = 0;days = 0;}
totalwork(int m, int d){months = m;days
= d;}
totalwork operator + (totalwork t){totalwork temp;temp.months = months +
t.months;temp.days = days + t.days;if (temp.days > 30){temp.months++;temp.days =
temp.days - 30;}
return temp;}
void display(void){cout << endl << endl <<
"Months : " << months;cout << endl << "Days : " << days;}
}
;void main(void){
totalwork e1(5,10);totalwork e2(3,25);totalwork e3;clrscr();e1.display();
e2.display();e3 = e2 + e1;e3.display();getch(); }
################################################################################
###############################################################################4
###È###Î###Ï###Z ##b     ##c    ##ˆ  ##ˆ   ##ˆ   ##æ   ##ê   ##ë   ##ˆ###¥###
###
##ç##÷##û##
###¯###Á###W###e###}
###ˆ###g###|
#######(###+###0###3###6###l###ˆ###L###N###u###¶###¸###Á###Ã###î#######ùèùäèùäèù
äèùäèÐè¼è¼è¼è¼è¼è¨ˆùè¼è¼è¼èùèˆùèwèwèÐ#### #h
?ý##hû###CJ##OJ##QJ##^J##aJ#####h
?ý##hû###CJ##OJ##QJ##^J### #h
?ý##hû###CJ #OJ##QJ##^J##aJ###&#h
?ý##hû###5#ˆCJ   #OJ##QJ###ˆ^J##aJ###&#h
?ý##hû###5#ˆCJ##OJ##QJ###ˆ^J##aJ###&#h
?ý##hû###6#ˆCJ##OJ##QJ##]#ˆ^J##aJ#####hˆBÜ## #h
?ý##hû###CJ##OJ##QJ##^J##aJ###
#h
?ý##hû###.####+###4###[###È###Ï###@ ##Z   ##c   ##ˆ   ##ˆ   ##æ   ##ë   ###
##V
##Â
##1###ˆ###
##|
##ó
##T##Ç
##5###ˆ###÷###b###ú############õ############ì############ì############ç#########
###ì############ì############ç############ì############ç############ì###########
#ç############ì############ì############ì############ì############ì############ì
############ì############ì############ì############ì############ì############ì##
##########ì############ì################################gdˆBÜ#

##7$#8$#H$#gdû#######gdÓNk#####gdÓNk###b###Ò###>###}
###ˆ###Ð#######/###R###g###|
###ô#######P###s###ˆ###Î###õ###6###l###ˆ###ˆ###°###Ò###ó###########/###N###ö####
########ö############ö############ö############ö############ö############ö######
######ö############ö############ñ############ö############ö############ö########
####ö############ö############ö############ö############ö############ö##########
##ñ############ö############ö############ö############ö############ö############
ö############ö############ö##################gd#KJ#

##7$#8$#H$#gdû#####N###u###¶###)###ˆ###Á###/###ˆ###û###f###s###u###ç######Ó###û
###j###ˆ###¥###Õ###í###############>###i###k###p###r###ú############ñ###########
#ñ############ñ############ñ############ñ############ñ############ñ############ñ
############ñ############ñ############ñ############ñ############ñ############ñ##
##########ñ############ñ############ú############ñ############ñ############ñ####
########ñ############ñ############ñ############ñ############ñ############ñ######
######ñ##############   ##7$#8$#H$#gdû#######gd#KJ#######s###u###w###|
###û###ý###ˆ###¥###Õ###########i###k###p###r###·###¹###¾###À###

#######*###3###4###ˆ###ˆ###########C###E###)###I###d###ˆ###ˆ###ˆ###¤###¥###ç####
##ïÞïÊïÞïÃïÊï¯ïˆï¯ïˆï¯ïÈÊïÞïÞïÞï¯ï¯ïˆÃˆït############################&#h
?ý##hû###5#ˆCJ
#OJ##QJ###ˆ^J##aJ#####h
?ý##hû###CJ##OJ##QJ##^J#####h#KJ##&#h
?ý##hû###5#ˆCJ##OJ##QJ###ˆ^J##aJ###&#h
?ý##hû###6#ˆCJ##OJ##QJ##]#ˆ^J##aJ###
#h
?ý##hû####&#h
?ý##hû###5#ˆCJ##OJ##QJ###ˆ^J##aJ### #h
?ý##hû###CJ##OJ##QJ##^J##aJ### #h
?ý##hû###CJ##OJ##QJ##^J##aJ##(r###ˆ###·###¹###¾###À###á###

#######*###3###ˆ#######ˆ###¥###Ü###########/###`###ˆ###õ#######C###¬#######)###I
###d###ö############ö############ö############ö############ö############ö#######
#####ö############ö############ñ############ñ############ö############ö#########
###ö############ö############ö############ö############ö############ö###########
#ö############ö############ö############ö############ö############ö############ö
############ö############ö############ö##################gd#KJ#
      ##7$#8$#H$#gdû#####d###ˆ###ˆ###¥###ç#### ##0 ##@ ##R ##X ##ˆ ##ˆ ##¥ ##Ô
##ä ##ø ##û ###!###!###!##<!##L!##Y!##d!##ˆ!##ˆ!##¡!##Â!##È!
##ö############ö############ñ############ö############ö############ö############
ö############ö############ö############ö############ö############ö############ö#
###########ö############ö############ö############ö############ö############ö###
#########ö############ö############ö############ö############ö############ö#####
#######ö############ö############ö##################gd#KJ# ##7$#8$#H$#gdû#####È!
##Ô!##Ü!##è!
###"###"##'"##1"##="##e"##p"##w"##|"##ˆ"##ˆ"##¨"##À"##Ô"##á"##ü"######ˆ###
$##ˆ$##ÿ$###%###%##M%##d
%##ö############ö############ö############ö############ö############ö###########
#ö############ö############ö############ö############ö############ö############ö
############ö############ö############ö############ö############ö############ö##
##########ö############ö############ö############ö############ö############ö####
########ö############ö############ö##########################7$#8$#H$#gdû######
##|"##ˆ"##ˆ"##ˆ"##ˆ"##¨"##ª"##À"##Â"##Ô"##Ö"##á"##ã"##ü"######.###3###t###y###O$
##T$##÷$##ü$###%###%###%###%###%##&%##÷%##ý%###&###&##
&##ïÞÍÞÍÞÍÞÍÞÍÞÍÞ¹Þ¹Þ¹Þ¹Þ¹Þ¹Þ«ˆˆÞ}
fÞW##h
?ý##hû###CJ##OJ##QJ##^J###,#h
?ý##hû###5#ˆ6#ˆCJ##OJ##QJ###ˆ]#ˆ^J##aJ###&#h
?ý##hû###6#ˆCJ##OJ##QJ##]#ˆ^J##aJ#####h1R
##hû###0J### #h
?ý##h1R
#CJ##OJ##QJ##^J##aJ#####hû###CJ##OJ##QJ##^J##aJ###&#h
?ý##hû###5#ˆCJ##OJ##QJ###ˆ^J##aJ### #h
?ý##hû###CJ##OJ##QJ##^J##aJ### #h
?ý##hû###CJ##OJ##QJ##^J##aJ### #h
?ý##hû###CJ
#OJ##QJ##^J##aJ##"d%##t%##v%##}
%##ˆ%##ˆ%##ˆ%##ˆ%##²%##Â%##Ä%##Ë%##Ò%##ì%###&##
&##*&##ˆ&##ˆ&##¥&##³&##È&##õ&##
'##
'##0'##2'##M'##a'##ö############ö############ö############ö############ö########
####ö############ö############ö############ö############ö############ö##########
##ö############ö############ö############ö############ñ############ö############
ö############ö############ö############ö############ö############ö############ö#
###########ö############ö############ö############ö##################gd
&.#   ##7$#8$#H$#gdû#####
&##*&##+&##ˆ&##¥&##¶&##·&##2'##M'##q(##ˆ(##Û(##à(##))##0)##ˆ*##±*##Ï*##Ó*##ˆ+##ˆ
+###,##     ,##
,###,##ˆ,##¤,##¥,##¦,##ˆ-##¸-##ÿ-###.## .###.##X.##Z.##ˆ.##ˆ.##ˆ.##
ˆ.##üè×è×É×è×è×è×è×è×è×è׸«×§è׈׈wˆ×h×è×è######h
?
ý##hû###CJ##OJ##QJ##^J#####hö(ˆ#CJ##OJ##QJ##^J##aJ#####hF#~#CJ##OJ##QJ##^J##aJ##
#&#h
?ý##hû###6#ˆCJ##OJ##QJ##]#ˆ^J##aJ#####hu#Î####h
?ý##hû###OJ##QJ##^J#####h4Rˆ#OJ##QJ##^J###
#h
?ý##hû######hFEí#CJ##OJ##QJ##^J##aJ### #h
?ý##hû###CJ##OJ##QJ##^J##aJ###&#h
?ý##hû###5#ˆCJ##OJ##QJ###ˆ^J##aJ#####h
&.#(a'##{'##ˆ'##¡'##Ì'##Õ'##×'##)(##1(##N(##(##q(##å(##))##
ˆ)##ÿ)##r*##ˆ*##±*##(+##ˆ+###,###,##!,##6,##L,##j,##
ˆ,##ö############ö############ö############ö############ö############ö##########
##ö############ö############ö############ö############ö############ö############
ö############ö############ö############ö############ö############ö############ö#
###########ö############ö############ñ############ö############ö############ö###
#########ö############ö###################################gd4Rˆ#
      ##7$#8$#H$#gdû#####ˆ,##¥,##í,##÷,##<-##S-##g-##w-##y-##ˆ-##¸-##Ö-##ä-
###.##N.##Z.##
¢.##¹.##Í.##Ý.##ß.##í.###/##</##S/##]/##ˆ/##©/##Å/##ú############ñ############ñ#
###########ñ############ñ############ñ############ñ############ñ############ñ###
#########ñ############ñ############ñ############ñ############ñ############ñ#####
#######ñ############ñ############ñ############ñ############ñ############ñ#######
#####ñ############ñ############ñ############ñ############ñ############ñ#########
###ñ##############      ##7$#8$#H$#gdû#######gdu#Î###ˆ.##</##S/##
ˆ/##ˆ/##¤/##©/##Ò/##ð/##ñ/##ò/##w2##ˆ2##³4##µ4##Ê4##Ë4##¸5##Õ5###7##)7##]7##m7##
#8###8##E8##M8##]8##ˆ8##ˆ8##ˆ8##½9##¿9## :###:##ˆ:##
ˆ:##_;##u;##¸;##Ï;##õ;###<##T<##a<##ª<##º<##
=##!=##ˆ=##ˆ=##ˆ=## =##±=##²=##³=##·=##ïÛïÛïÛïÒÛÁïºï«º§ïºïºïÛïÛïÛïˆïÛï«ïÛïÛïÛïÛï
ÛïÛïÛïÛïÛï«ÒÛÁï##########&#h
?ý##hû###6#ˆCJ##OJ##QJ##]#ˆ^J##aJ#####hi8~####h
?ý##hû###CJ##OJ##QJ##^J###
#h
?ý##hû#### #hi8~#5#ˆCJ##OJ##QJ###ˆ^J##aJ#####hi8~##hû###0J###&#h
?ý##hû###5#ˆCJ##OJ##QJ###ˆ^J##aJ### #h
?ý##hû###CJ##OJ##QJ##^J##aJ##8Å/##Î/##Ð/##Ò/##ò/##=0##®0##
1##u1##ˆ1##¸1##Þ1##þ1###2##-
2##R2##w2##ˆ2###3###3##93##a3##ˆ3##¨3##µ3##)4##34##<4##C4##ö############ö#######
#####ö############ö############ö############ö############ö############ö#########
###ö############ö############ö############ö############ö############ö###########
#ö############ö############ñ############ö############ö############ö############ö
############ö############ö############ö############ö############ö############ö##
##########ö##################gdi8~#
      ##7$#8$#H$#gdû#####C4##n4##x4##ˆ4##ˆ4##µ4##Ë4##!5##ˆ5##¸5##Õ5##á5##ð5##
      6##
%6##16##A6##J6##`6##t6##ˆ6##ˆ6##ˆ6##ˆ6##ˆ6##§6##Æ6##å6###7##ö############ö######
######ö############ö############ö############ñ############ö############ö########
####ö############ñ############ö############ö############ö############ö##########
##ö############ö############ö############ö############ö############ö############
ö############ö############ö############ö############ö############ö############ö#
###########ö##################gdi8~#
      ##7$#8$#H$#gdû######7###7###7##)7##27##F7##]7##m7##o7##{7##ˆ7##-
7##¶7##¸7##Á7##Õ7##ì7###8###8###8##
8##*8##B8##R8##ˆ8##ˆ8##ˆ8##ý8##m9##ö############ö############ñ############ö#####
#######ö############ö############ö############ö############ö############ö#######
#####ö############ö############ö############ö############ö############ö#########
###ö############ö############ö############ö############ö############ö###########
#ö############ö############ö############ö############ö############ö#############
#####gdi8~# ##7$#8$#H$#gdû#####m9##¿9##È9##Ü9##ó9##
      :###:###:##':##1:##I:##Y:##i:##t:##}
:##ˆ:##ô:##+;##4;##H;##_;##u;##ˆ;##
ˆ;##ˆ;##
ˆ;##µ;##Ï;##ß;##ö############ö############ö############ö############ö###########
#ö############ö############ö############ö############ö############ö############ö
############ö############ö############ö############ö############ö############ö##
##########ö############ö############ö############ö############ö############ö####
########ö############ö############ö############ö########################

##7$#8$#H$#gdû#####ß;##ê;##ó;##õ;##T<##a<##i<##}
<##ˆ<##ª<##º<##¼<##Ç<##Ô<##Þ<###
=##
=##!=##J=##ˆ=##ˆ=##ˆ=## =##³=##ï=###>##(>##@>##
´>##ö############ö############ö############ö############ö############ö##########
##ö############ö############ö############ö############ö############ö############
ö############ö############ö############ö############ö############ö############ö#
###########ö############ö############ö############ö############ö############ö###
#########ö############ö############ö########################

##7$#8$#H$#gdû#####·=##Æ=##ï=##ñ=###>###>##(>##*>##@>##S>##¾>##Ý>##Þ>##ß>##÷?
###@###@###@##ø@##û@##
A###A###A###A##,A##ÁA##ÓA##1B##3B##¹B##ÉB##wD##yD##úE##&F##ˆF##ˆF##ˆF##ïÞÍÞÍÞÍÞ¹
Þ²®¹Þ²®¹ÞˆÞˆÞˆ¹Þ¹Þ¹Þ¹ÞzÞ¹Þq¹#######################################hÎ_,##hû###0J
#####h
?ý##hû###CJ##OJ##QJ##^J###&#h
?ý##hû###6#ˆCJ##OJ##QJ##]#ˆ^J##aJ### #h
?ý##hû###CJ##OJ   #QJ   #^J   #aJ#####hÎ_,##
#h
?ý##hû####&#h
?ý##hû###5#ˆCJ##OJ##QJ###ˆ^J##aJ### #h
?ý##hû###CJ##OJ##QJ##^J##aJ### #h
?ý##hû###CJ##OJ##QJ##^J##aJ### #h
?ý##hi8~#CJ##OJ##QJ##^J##aJ##%´>##¾>##Þ>##0?##¢?##³?##É?##Þ?##÷?
###@##l@##â@##ë@##      A###A###A##ˆA##ˆA##ªA##ÁA##ÑA##ÓA##ÝA##çA##ýA##

B###B##1B##3B##ö############ñ############ö############ö############ö############
ö############ö############ö############ñ############ö############ö############ö#
###########ö############ö############ö############ö############ö############ö###
#########ö############ö############ö############ö############ö############ö#####
#######ö############ö############ö############ö##################gdÎ_,#
      ##7$#8$#H$#gdû#####3B##ˆB##¥B##¹B##ÉB##ËB##åB##ïB###C##HC##tC## C##ÌC##ØC#
#ôC###D##,D##HD##nD##yD##{D##ÛD##òD###E###E###E##&E##7E##AE##ö############ö#####
#######ö############ö############ö############ö############ö############ö#######
#####ö############ö############ö############ö############ö############ö#########
###ö############ö############ö############ö############ö############ö###########
#ö############ö############ö############ö############ö############ö############ö
############ö########################

##7$#8$#H$#gdû#####AE##[E##gE##sE##ˆE##ˆE##¦E##½E##ÌE##ãE##îE##úE##&F##7F##WF##
F##ˆF##ˆF##ˆF## F###G##ˆG##ˆG##¡G##°G##²G##ÁG##ÃG##ÅG##ö############ö###########
#ö############ö############ö############ö############ö############ö############ö
############ö############ö############ö############ö############ö############ö##
##########ö############ö############ö############ö############ö############ö####
########ö############ö############ö############ö############ö############ö######
######ö########################    ##7$#8$#H$#gdû#####ˆF## F##ˆG##¡G##úG##
H##¡H##¤H##H##ôH###I##/I##½I##ÇI###J##DJ##|J##ˆJ##ÅJ##ÏJ##
K###K##SK##]K##ˆK##êK##.L##ûL##M###N###N##"N##
%N###O###O###O###O##0O##4O##ˆO##ÂO###P###P##ÅQ##ÍQ##ÐR##àR##ßS##âS##ëS##ÁT##ÑT##
ÓT##ÞT##ˆV##ïÞÇÞ³Þ¤³ˆÞ³Þ³Þ³Þ³Þ³Þ³Þ³ÞLjވޤވ޳޳޳޳ވވ޳ޤÇÞ³Þ³Þ
#h
?ý##hû####&#h
?ý##hû###6#ˆCJ##OJ##QJ##]#ˆ^J##aJ#####h
?ý##hû###CJ##OJ##QJ##^J###&#h
?ý##hû###5#ˆCJ##OJ##QJ###ˆ^J##aJ###,#h
?ý##hû###5#ˆ6#ˆCJ##OJ##QJ###ˆ]#ˆ^J##aJ### #h
?ý##hû###CJ##OJ##QJ##^J##aJ###
#hÎ_,#5#ˆCJ##OJ##QJ###ˆ^J##aJ##6ÅG##ÇG##ÏG##æG##úG##
H##
H###H###H##8H##DH##TH##VH##fH##hH##ˆH##ˆH##ˆH##ˆH##¤H##ôH###I###I##/I##1I##:I##D
I##fI##tI##ö############ö############ö############ö############ö############ö###
#########ö############ö############ö############ö############ö############ö#####
#######ö############ö############ö############ö############ö############ö#######
#####ö############ö############ö############ö############ö############ö#########
###ö############ö############ö############ö########################
      ##7$#8$#H$#gdû#####tI##ˆI##ˆI##»I##½I###J##:J##|J##ÅJ##
K##SK##ˆK##ˆK##áK##.L##EL##YL##mL##}
L##ˆL##ˆL##ˆL##®L##¼L##ÏL##ùL##ûL##
M##ˆM##ö############ö############ö############ö############ö############ö#######
#####ö############ö############ö############ö############ö############ö#########
###ö############ö############ö############ö############ö############ö###########
#ö############ö############ö############ö############ö############ö############ö
############ö############ñ############ö##################gdÝvm#
      ##7$#8$#H$#gdû#####ˆM##¶M##¾M##ÍM##×M##ÜM##æM##éM##øM##úM###N###N###N##
N###N###N##ˆN##ëN###O###O###O##0O##;O##EO##O##iO##ˆO##ˆO##£O##ö############ö###
#########ö############ö############ö############ö############ö############ö#####
#######ö############ö############ö############ö############ö############ö#######
#####ö############ö############ö############ö############ö############ö#########
###ö############ö############ö############ö############ö############ö###########
#ö############ö########################

##7$#8$#H$#gdû#####£O##°O##µO##ÂO##×O###P###P###P##ˆP##ýP##rQ##ÅQ##ÍQ##ÜQ##ÞQ##è
Q##êQ##þQ###R##
R##
R###R###R###R###R##ˆR##¥R##¼R##ÐR##ö############ö############ö############ö#####
#######ö############ö############ñ############ö############ö############ö#######
#####ö############ö############ö############ö############ö############ö#########
###ö############ö############ö############ö############ö############ö###########
#ö############ö############ö############ö############ö############ö#############
#####gdÝvm#
      ##7$#8$#H$#gdû#####ÐR##àR##âR##íR##÷R###S###S##1S##FS##S##rS##ˆS##ˆS##-
S##¿S##ÄS##ÔS##âS##VT##ˆT##-
T##ÁT##ÑT##ÓT##ÞT##çT##ñT###U###U##ö############ö############ö############ö#####
#######ö############ö############ö############ö############ö############ö#######
#####ö############ö############ö############ö############ö############ö#########
###ö############ö############ö############ö############ö############ö###########
#ö############ö############ö############ö############ö############ö#############
###########

##7$#8$#H$#gdû######U##>U##IU##fU##uU##ˆU##ˆU##¸U##ÌU##òU###V##,V##@V##fV##kV##ˆ
V##ˆV##ˆV##¡V###W##5W##WW##`W##hW##pW##ãW##0X##¨X##åX##ö############ö###########
#ö############ö############ö############ö############ö############ö############ö
############ö############ö############ö############ö############ö############ö##
##########ö############ö############ñ############ö############ö############ö####
########ö############ö############ö############ö############ö############ö######
######ö##################gdÝvm#

##7$#8$#H$#gdû#####ˆV##ˆV##ˆV##¡V##pW##tW##0X##3X##åX##éX##zY##}
Y##ˆY##ÄY##ÔY##Ö
Y##áY##Ñ[##Ú[##î[##þ[##1##@##N##h##ˆ##¤##Ë##ë###]###]##K]##T]##¾]##Î]##
^###^##D^##I^##q^##t^##ˆ
^##Ç^##Ï^###`###`##[`##g`##i`##q`##ˆ`##ˆ`##½`##Å`##é`##ñ`##
a###a##8a##Aa##ua##ˆa##
¢a##ªa##ìa##ýa##&b##Nb##Ub##bb##®b##ºb##ùéùØÄØÄØÄصÄØÄØÄØÄØÄØÄØÄØÄØÄØÄØÄØÄØÄØÄص
ÄØÄØÄØÄØÄØÄØÄØÄØÄØÄØùØÄØÄØÄØÄØÄ#####h
?ý##hû###CJ##OJ##QJ##^J###&#h
?ý##hû###5#ˆCJ##OJ##QJ###ˆ^J##aJ### #h
?ý##hû###CJ##OJ##QJ##^J##aJ#####h
?ý##hû###6#ˆOJ##QJ##]#ˆ^J###
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++
c++

Contenu connexe

Similaire à c++

Le langage C.pdf
Le langage C.pdfLe langage C.pdf
Le langage C.pdfNoamHaythem
 
0519-pdf-php-bases-initiation.pdf
0519-pdf-php-bases-initiation.pdf0519-pdf-php-bases-initiation.pdf
0519-pdf-php-bases-initiation.pdfRihabBENLAMINE
 
Cours_C_for_Etudiant.pdf
Cours_C_for_Etudiant.pdfCours_C_for_Etudiant.pdf
Cours_C_for_Etudiant.pdfHailisara
 
Fiche de TD 1 de préparation probatoire (littéraire et scientifique) du Camer...
Fiche de TD 1 de préparation probatoire (littéraire et scientifique) du Camer...Fiche de TD 1 de préparation probatoire (littéraire et scientifique) du Camer...
Fiche de TD 1 de préparation probatoire (littéraire et scientifique) du Camer...ATPENSC-Group
 
Fiche de TD 2 de préparation probatoire (littéraire et scientifique) du Camer...
Fiche de TD 2 de préparation probatoire (littéraire et scientifique) du Camer...Fiche de TD 2 de préparation probatoire (littéraire et scientifique) du Camer...
Fiche de TD 2 de préparation probatoire (littéraire et scientifique) du Camer...ATPENSC-Group
 
ESGAE_C#_2021-2024 Cours Avancé (('.pptx
ESGAE_C#_2021-2024 Cours Avancé (('.pptxESGAE_C#_2021-2024 Cours Avancé (('.pptx
ESGAE_C#_2021-2024 Cours Avancé (('.pptxLagloireSouamounou
 
Qualité logicielle
Qualité logicielleQualité logicielle
Qualité logiciellecyrilgandon
 
Cours c#
Cours c#Cours c#
Cours c#zan
 
05 visual basic .net - variables, procedures, arguments et structures de cont...
05 visual basic .net - variables, procedures, arguments et structures de cont...05 visual basic .net - variables, procedures, arguments et structures de cont...
05 visual basic .net - variables, procedures, arguments et structures de cont...Hamza SAID
 
Chap1V2019: Cours en C++
Chap1V2019: Cours en C++Chap1V2019: Cours en C++
Chap1V2019: Cours en C++Aziz Darouichi
 
Formation python
Formation pythonFormation python
Formation pythonj_lipaz
 
02 Spécificité du C++ COURS SYS SYSSSSSS
02 Spécificité du C++  COURS SYS SYSSSSSS02 Spécificité du C++  COURS SYS SYSSSSSS
02 Spécificité du C++ COURS SYS SYSSSSSSAyoubElmrabet6
 
Performance et optimisation de PrestaShop
Performance et optimisation de PrestaShopPerformance et optimisation de PrestaShop
Performance et optimisation de PrestaShopPrestaShop
 

Similaire à c++ (20)

Le langage C.pdf
Le langage C.pdfLe langage C.pdf
Le langage C.pdf
 
0519-pdf-php-bases-initiation.pdf
0519-pdf-php-bases-initiation.pdf0519-pdf-php-bases-initiation.pdf
0519-pdf-php-bases-initiation.pdf
 
Cours_C_for_Etudiant.pdf
Cours_C_for_Etudiant.pdfCours_C_for_Etudiant.pdf
Cours_C_for_Etudiant.pdf
 
Langage C
Langage CLangage C
Langage C
 
Fascicule tp programmation c
Fascicule tp programmation cFascicule tp programmation c
Fascicule tp programmation c
 
Asd
AsdAsd
Asd
 
Ktab asd
Ktab asdKtab asd
Ktab asd
 
Fiche de TD 1 de préparation probatoire (littéraire et scientifique) du Camer...
Fiche de TD 1 de préparation probatoire (littéraire et scientifique) du Camer...Fiche de TD 1 de préparation probatoire (littéraire et scientifique) du Camer...
Fiche de TD 1 de préparation probatoire (littéraire et scientifique) du Camer...
 
Fiche de TD 2 de préparation probatoire (littéraire et scientifique) du Camer...
Fiche de TD 2 de préparation probatoire (littéraire et scientifique) du Camer...Fiche de TD 2 de préparation probatoire (littéraire et scientifique) du Camer...
Fiche de TD 2 de préparation probatoire (littéraire et scientifique) du Camer...
 
ESGAE_C#_2021-2024 Cours Avancé (('.pptx
ESGAE_C#_2021-2024 Cours Avancé (('.pptxESGAE_C#_2021-2024 Cours Avancé (('.pptx
ESGAE_C#_2021-2024 Cours Avancé (('.pptx
 
Qualité logicielle
Qualité logicielleQualité logicielle
Qualité logicielle
 
Cours c#
Cours c#Cours c#
Cours c#
 
Tp introduction java
Tp introduction javaTp introduction java
Tp introduction java
 
05 visual basic .net - variables, procedures, arguments et structures de cont...
05 visual basic .net - variables, procedures, arguments et structures de cont...05 visual basic .net - variables, procedures, arguments et structures de cont...
05 visual basic .net - variables, procedures, arguments et structures de cont...
 
Chap1V2019: Cours en C++
Chap1V2019: Cours en C++Chap1V2019: Cours en C++
Chap1V2019: Cours en C++
 
Formation python
Formation pythonFormation python
Formation python
 
02 Spécificité du C++ COURS SYS SYSSSSSS
02 Spécificité du C++  COURS SYS SYSSSSSS02 Spécificité du C++  COURS SYS SYSSSSSS
02 Spécificité du C++ COURS SYS SYSSSSSS
 
Performance et optimisation de PrestaShop
Performance et optimisation de PrestaShopPerformance et optimisation de PrestaShop
Performance et optimisation de PrestaShop
 
Microsoft07coursbaptiste
Microsoft07coursbaptisteMicrosoft07coursbaptiste
Microsoft07coursbaptiste
 
Cours 01.pptx
Cours 01.pptxCours 01.pptx
Cours 01.pptx
 

Dernier

Boléro. pptx Film français réalisé par une femme.
Boléro.  pptx   Film   français   réalisé  par une  femme.Boléro.  pptx   Film   français   réalisé  par une  femme.
Boléro. pptx Film français réalisé par une femme.Txaruka
 
présentation sur l'échafaudage dans des travaux en hauteur
présentation sur l'échafaudage dans des travaux en hauteurprésentation sur l'échafaudage dans des travaux en hauteur
présentation sur l'échafaudage dans des travaux en hauteurdinaelchaine
 
Présentation de cartes d'extension zhr..pptx
Présentation de cartes d'extension zhr..pptxPrésentation de cartes d'extension zhr..pptx
Présentation de cartes d'extension zhr..pptxpopzair
 
presentation l'interactionnisme symbolique finale.pptx
presentation l'interactionnisme symbolique  finale.pptxpresentation l'interactionnisme symbolique  finale.pptx
presentation l'interactionnisme symbolique finale.pptxMalikaIdseaid1
 
A3iFormations, organisme de formations certifié qualiopi.
A3iFormations, organisme de formations certifié qualiopi.A3iFormations, organisme de formations certifié qualiopi.
A3iFormations, organisme de formations certifié qualiopi.Franck Apolis
 
Formation M2i - Intelligence Artificielle Comment booster votre productivité ...
Formation M2i - Intelligence Artificielle Comment booster votre productivité ...Formation M2i - Intelligence Artificielle Comment booster votre productivité ...
Formation M2i - Intelligence Artificielle Comment booster votre productivité ...M2i Formation
 
gestion des conflits dans les entreprises
gestion des  conflits dans les entreprisesgestion des  conflits dans les entreprises
gestion des conflits dans les entreprisesMajdaKtiri2
 
666148532-Formation-Habilitation-ELECTRIQUE-ENTREPRISE-MARS-2017.pptx
666148532-Formation-Habilitation-ELECTRIQUE-ENTREPRISE-MARS-2017.pptx666148532-Formation-Habilitation-ELECTRIQUE-ENTREPRISE-MARS-2017.pptx
666148532-Formation-Habilitation-ELECTRIQUE-ENTREPRISE-MARS-2017.pptxSAID MASHATE
 
Bolero. pptx . Film de A nnne Fontaine
Bolero. pptx . Film   de  A nnne FontaineBolero. pptx . Film   de  A nnne Fontaine
Bolero. pptx . Film de A nnne FontaineTxaruka
 
Mécanique Automobile LE TURBOCOMPRESSEUR.ppt
Mécanique Automobile LE TURBOCOMPRESSEUR.pptMécanique Automobile LE TURBOCOMPRESSEUR.ppt
Mécanique Automobile LE TURBOCOMPRESSEUR.pptssusercbaa22
 
Grammaire pour les élèves de la 6ème.doc
Grammaire pour les élèves de la  6ème.docGrammaire pour les élèves de la  6ème.doc
Grammaire pour les élèves de la 6ème.docKarimKhrifech
 
MICROBIOLOGIE ENDODONTIQUE english and frensh 25 nov 2020.pdf
MICROBIOLOGIE ENDODONTIQUE english and frensh 25 nov 2020.pdfMICROBIOLOGIE ENDODONTIQUE english and frensh 25 nov 2020.pdf
MICROBIOLOGIE ENDODONTIQUE english and frensh 25 nov 2020.pdfssuser40e112
 
SUPPORT DE SUR COURS_GOUVERNANCE_SI_M2.pptx
SUPPORT DE SUR COURS_GOUVERNANCE_SI_M2.pptxSUPPORT DE SUR COURS_GOUVERNANCE_SI_M2.pptx
SUPPORT DE SUR COURS_GOUVERNANCE_SI_M2.pptxssuserbd075f
 
LA MONTÉE DE L'ÉDUCATION DANS LE MONDE DE LA PRÉHISTOIRE À L'ÈRE CONTEMPORAIN...
LA MONTÉE DE L'ÉDUCATION DANS LE MONDE DE LA PRÉHISTOIRE À L'ÈRE CONTEMPORAIN...LA MONTÉE DE L'ÉDUCATION DANS LE MONDE DE LA PRÉHISTOIRE À L'ÈRE CONTEMPORAIN...
LA MONTÉE DE L'ÉDUCATION DANS LE MONDE DE LA PRÉHISTOIRE À L'ÈRE CONTEMPORAIN...Faga1939
 
systeme expert_systeme expert_systeme expert
systeme expert_systeme expert_systeme expertsysteme expert_systeme expert_systeme expert
systeme expert_systeme expert_systeme expertChristianMbip
 
Fondation Louis Vuitton. pptx
Fondation      Louis      Vuitton.   pptxFondation      Louis      Vuitton.   pptx
Fondation Louis Vuitton. pptxTxaruka
 
Approche-des-risques-par-l’analyse-des-accidents-1.pptx
Approche-des-risques-par-l’analyse-des-accidents-1.pptxApproche-des-risques-par-l’analyse-des-accidents-1.pptx
Approche-des-risques-par-l’analyse-des-accidents-1.pptxssusercbaa22
 
Cours-irrigation_et_drainage_cours1.pptx
Cours-irrigation_et_drainage_cours1.pptxCours-irrigation_et_drainage_cours1.pptx
Cours-irrigation_et_drainage_cours1.pptxlamourfrantz
 

Dernier (20)

Boléro. pptx Film français réalisé par une femme.
Boléro.  pptx   Film   français   réalisé  par une  femme.Boléro.  pptx   Film   français   réalisé  par une  femme.
Boléro. pptx Film français réalisé par une femme.
 
présentation sur l'échafaudage dans des travaux en hauteur
présentation sur l'échafaudage dans des travaux en hauteurprésentation sur l'échafaudage dans des travaux en hauteur
présentation sur l'échafaudage dans des travaux en hauteur
 
Présentation de cartes d'extension zhr..pptx
Présentation de cartes d'extension zhr..pptxPrésentation de cartes d'extension zhr..pptx
Présentation de cartes d'extension zhr..pptx
 
presentation l'interactionnisme symbolique finale.pptx
presentation l'interactionnisme symbolique  finale.pptxpresentation l'interactionnisme symbolique  finale.pptx
presentation l'interactionnisme symbolique finale.pptx
 
A3iFormations, organisme de formations certifié qualiopi.
A3iFormations, organisme de formations certifié qualiopi.A3iFormations, organisme de formations certifié qualiopi.
A3iFormations, organisme de formations certifié qualiopi.
 
Formation M2i - Intelligence Artificielle Comment booster votre productivité ...
Formation M2i - Intelligence Artificielle Comment booster votre productivité ...Formation M2i - Intelligence Artificielle Comment booster votre productivité ...
Formation M2i - Intelligence Artificielle Comment booster votre productivité ...
 
Evaluación Alumnos de Ecole Victor Hugo
Evaluación Alumnos de Ecole  Victor HugoEvaluación Alumnos de Ecole  Victor Hugo
Evaluación Alumnos de Ecole Victor Hugo
 
gestion des conflits dans les entreprises
gestion des  conflits dans les entreprisesgestion des  conflits dans les entreprises
gestion des conflits dans les entreprises
 
666148532-Formation-Habilitation-ELECTRIQUE-ENTREPRISE-MARS-2017.pptx
666148532-Formation-Habilitation-ELECTRIQUE-ENTREPRISE-MARS-2017.pptx666148532-Formation-Habilitation-ELECTRIQUE-ENTREPRISE-MARS-2017.pptx
666148532-Formation-Habilitation-ELECTRIQUE-ENTREPRISE-MARS-2017.pptx
 
Bolero. pptx . Film de A nnne Fontaine
Bolero. pptx . Film   de  A nnne FontaineBolero. pptx . Film   de  A nnne Fontaine
Bolero. pptx . Film de A nnne Fontaine
 
Mécanique Automobile LE TURBOCOMPRESSEUR.ppt
Mécanique Automobile LE TURBOCOMPRESSEUR.pptMécanique Automobile LE TURBOCOMPRESSEUR.ppt
Mécanique Automobile LE TURBOCOMPRESSEUR.ppt
 
Grammaire pour les élèves de la 6ème.doc
Grammaire pour les élèves de la  6ème.docGrammaire pour les élèves de la  6ème.doc
Grammaire pour les élèves de la 6ème.doc
 
Pâques de Sainte Marie-Euphrasie Pelletier
Pâques de Sainte Marie-Euphrasie PelletierPâques de Sainte Marie-Euphrasie Pelletier
Pâques de Sainte Marie-Euphrasie Pelletier
 
MICROBIOLOGIE ENDODONTIQUE english and frensh 25 nov 2020.pdf
MICROBIOLOGIE ENDODONTIQUE english and frensh 25 nov 2020.pdfMICROBIOLOGIE ENDODONTIQUE english and frensh 25 nov 2020.pdf
MICROBIOLOGIE ENDODONTIQUE english and frensh 25 nov 2020.pdf
 
SUPPORT DE SUR COURS_GOUVERNANCE_SI_M2.pptx
SUPPORT DE SUR COURS_GOUVERNANCE_SI_M2.pptxSUPPORT DE SUR COURS_GOUVERNANCE_SI_M2.pptx
SUPPORT DE SUR COURS_GOUVERNANCE_SI_M2.pptx
 
LA MONTÉE DE L'ÉDUCATION DANS LE MONDE DE LA PRÉHISTOIRE À L'ÈRE CONTEMPORAIN...
LA MONTÉE DE L'ÉDUCATION DANS LE MONDE DE LA PRÉHISTOIRE À L'ÈRE CONTEMPORAIN...LA MONTÉE DE L'ÉDUCATION DANS LE MONDE DE LA PRÉHISTOIRE À L'ÈRE CONTEMPORAIN...
LA MONTÉE DE L'ÉDUCATION DANS LE MONDE DE LA PRÉHISTOIRE À L'ÈRE CONTEMPORAIN...
 
systeme expert_systeme expert_systeme expert
systeme expert_systeme expert_systeme expertsysteme expert_systeme expert_systeme expert
systeme expert_systeme expert_systeme expert
 
Fondation Louis Vuitton. pptx
Fondation      Louis      Vuitton.   pptxFondation      Louis      Vuitton.   pptx
Fondation Louis Vuitton. pptx
 
Approche-des-risques-par-l’analyse-des-accidents-1.pptx
Approche-des-risques-par-l’analyse-des-accidents-1.pptxApproche-des-risques-par-l’analyse-des-accidents-1.pptx
Approche-des-risques-par-l’analyse-des-accidents-1.pptx
 
Cours-irrigation_et_drainage_cours1.pptx
Cours-irrigation_et_drainage_cours1.pptxCours-irrigation_et_drainage_cours1.pptx
Cours-irrigation_et_drainage_cours1.pptx
 

c++

  • 1. ####ìÍ##=Eu#øÍ##ˆþ##ˆþ##½Ou#'Eu#####ˆþ##ìÍ##ìÍ##°###$Î##½'#######Þ##ÝDu#øÍ## ###NˆÞ¢º#Í#Ô#ÔæiKÃ# #à3ˆ#Í######Ò######ˆ# @new c++ 08.doc#c#s.doc#g#Visual.Basic.2010.Mar.2010.pdf#d Database Applications Comprehensive.pdf#s_files#d from over 100 stock photo companies_files#ˆ|ØÎ###³ˆ| üÎ##äÎ###Rˆ|
  • 3. Ï##Ô###############¨Ï## ###ÔWhôÏ##¡Wˆ|@Ð##########°Ï## ###NEWC__~1.DOC## %#ôÑ##U_ˆ|j!ˆ|#üýˆˆ_ˆ|øûýˆ##%#####ÈÏ##´Ï##hÏ## #######¸Ï##ÍUˆ|ˆÏ##Ȳˆ| ´Ï##¬Ï###Ð##èÐ##############ˆÒ##########################,###|Ð##Ɉ|######## ### @Ð##ÜÏ##`³ˆ|']ˆ| @##################################################################### #########HÐ##########¨Ð######## ##üýˆ[8######ßXˆ|####tÐ##tÐ##tÐ##########¬Ð##¼êˆ|####[8##äÑ###Ñ##äÑ##Ø[ˆ| ÐÐ##øûýˆ##%#=ˆ|þjˆ|`³ˆ|ˆ#%#####øûýˆ@Ò######ˆÒ######ðÔ######@Ñ################ ##üýˆ#####Ñ##########
  • 4. Ñ###Rˆ|4Ñ##ä#######Ô#######LÑ###Tˆ|4Ñ##Ô###PÑ########ˆ|E###x####### ##(Ñ##hÒ##lÓ###éˆ|##ˆ|ÿÿÿÿ##ˆ|{#ˆ|»#ˆ|#### Ö##xÖ##j!ˆ|#üýˆˆ_ˆ|øûýˆˆ/ %#####ðÑ##ÜÑ##ˆÑ## #######àÑ##ÍUˆ|¸Ñ##Ȳˆ| ÜÑ##ÔÑ##DÒ###Ó##############¸Ô##########################,###¤Ò##Ɉ|######## ### hÒ###Ò##`³ˆ|']ˆ| @##################################################################### #####ˆ#A~####¯#A~####ÐÒ######## ##üýˆ[8######ßXˆ|####ˆÒ##ˆÒ####ˆ|##ˆ|üÕ##$###èÓ##gˆˆ|üÒ### ýˆ##ˆ|ˆ Ò######`Ó###éˆ|@#ˆ|#Öˆ|)@ˆ|#@ˆ|#### Ö##xÖ##0####Ô##àˆÝw#Ô###Ô##òÓ###Ô##########0 #2#ÜÖ######dÔ##ÜÖ######0###E###ˆ###0###########$Ô##########ôÓ##############
  • 6. Ö###éˆ| Ö## Ó########ˆ|E###x####### ##xÓ##ˆBˆ|¼Õ###éˆ|##ˆ|ÿÿÿÿ##ˆ|{#ˆ|»#ˆ| #Ù###Ù##ØØ##########À#Éq[8####Éq0#######x#Éq#?ˆ|0#2#ÜÖ##ôÓ###### ##Ô#####.##P#I#P#E##D#A#V# #R#P#C# #S#E#R#V#I#C#E################################################################## ###############################################°Ô###Rˆ| ØÔ##ä#######Ô#######ðÔ###Tˆ|ØÔ##ˆÓˆ|ˆ#ˆ|©###############ôÔ##(# #####################hCˆ|#########Õ##܈ˆ|ˆ#######@#ˆ|#Öˆ|)@ˆ|#@ˆ| #####Ù##ØØ######4Õ## #######ˆÕ##BÖ##Õ###############üýˆ#Ù#######üýˆ########E### ################PÖ##
  • 8. ###ˆ###NÖ####ˆ|ÔÕ########ˆ|####x#######ˆ###¬Õ######ð×###éˆ|##ˆ|ÿÿÿÿ##ˆ|{#ˆ|»#ˆ| Ä=##°=#############$####ðýˆ###### #@ˆ|#####Ù##########PÖ######TÖ########ˆ|####Ø#######°=##,Ö## ###pØ###éˆ|##ˆ| ÿÿÿÿ##ˆ|{#ˆ|»#ˆ|õ ˆ| ÀÛ############################################################################## ################################################################################ ################################################################################ ########################################Ù#ˆ| Ä=##ˆ###################################################ì×########ˆ|E###x####### ##Ä×#######Ú###éˆ|#Ø########ˆ|E###x####### ##ð×##¶#ˆ|4Ú###éˆ|DØ########ˆ| E###x####### ###Ø##XØ##`Ú###éˆ|##ˆ|ÿÿÿÿ##ˆ|{#ˆ|»#ˆ|####ˆÝ######8### #######`Ö##ˆÕˆ|ˆþ###éˆ|ˆØ##
  • 9. #ˆ|Ä=######ˆØ##ïˆ|Ä=##õ ˆ|ÀÛ##ˆÛ##5îˆ|¬###$Þ######Hîˆ| #########Ù##@###########ÀÛ###üýˆ ######´ ##########`########üýˆ############´ ##С##ˆÓˆ|ˆ#ˆ|©###############@Ù##(# #############ˆÓˆ|ˆ#ˆ| ©###############lÙ##(# ###########ˆ|½Ou###@###@###@#`Ù######ˆÙ##e#ˆ| ##@#########¼Ù####ˆ|½Ou###ˆ|#Ý##à#ˆ|ˆÙ######ÀÝ###éˆ|##ˆ|ÿÿÿÿ##ˆ|ì^ˆ|#«ˆ|x±ˆ| ####ÀÝ######ìÝ##jHúˆ#Pu##Ú##¨2ˆ|ÐÚ##ÀÝ##ðÚ##¤Ú##ÀÝ##¼2ˆ|ÀÝ##¸Ú##z2ˆ| ÐÚ##ÀÝ##ðÚ##¤Ú##½Ou#####ÐÚ##ÀÝ##煮|ÐÚ##ÀÝ##ðÚ##¤Ú##½Ou#####ÐÚ##ˆþ###Ý###éˆ|ˆ Ý#######Ý###Bˆ|¨ ##èÚ##@#ˆ|#Öˆ|ÇBˆ|ˆBˆ|>###(×##################
  • 10. #2####### #@ˆ|#####ð## ##ìÝ##jäˆ|LЈ|xäˆ|ðÚ#########ˆ#########Eu##########$ˆ|ôäˆ|? ###########################ˆ#ÿÿ @ÿÿÿÿÿÿˆn=w##"#H#=w##ÿÿp#"#ô×##P###########D###A#p#p#a#t#i#o#n#l#e###M#F#p#p#l#i #c########ˆÿ?#######ˆÿ?########;###############ˆþ##°=##ôäˆ|#$ˆ| ####ìÝ###Pu#####F###¼Ý######ˆ# @##"#ˆn=w####H#=w##ÿÿˆ###ÿÿ##p#"#ô×##P#######################D###A#p#p#######a#t #i#o#n#######l#e###M#F#######p#p#l#i#c##############ˆÿ?#############ˆÿ? ##########,Ù##¬Ü#C########,Ù##¬Ü#C########ÖÜ##ˆ4##ÀØ##{pÝw´### ´Ø##ØØ##p#"#ÐØ##ÈØ## ´########à######H8÷w####8Ý##·BöwD###H8÷wD###dÝ#######à##dÝ###à##ÂBöwdÝ########## p#"##à##¬Þ##ˆ#######ÿÿÿÿÅoˆ|ˆ#ˆ#LÜ##,Ù######x>##ì###C#:##D#o#c#u#m#e#n#t#s# #a#n#d# #S#e#t#t#i#n#g#s##A#d#m#i#n#i#s#t#r#a#t#o#r##>,##ÄÚ##ÄÚ##ÐCöwÿÿ###Û########### æ##øˆˆ|ÝCöwøˆˆ|########òOu#ÞOu#ˆþ##ˆþ##½Ou##Eu#####ˆþ##ìÝ##ìÝ##°=###Öˆ|Uéˆ| #####Þ##ˆDu#PÞ######ˆþ###Þ###Þ##°=##PÞ##½'##C++ Dî##ÔDu#PÞ######Üá# º#Í#ú·#Lˆ§Ä#ˆçˆèiKÃ#############ˆ# @C++ Hazrat Ali Nasar Nots#hm#eference.May.2008.pdf## ###`#°ÜÞ##¡Wˆ|Àß##########0ß## ######Àøûýˆˆ#%#¼# %#tá##U_ˆ|ôÞ########ˆ|E###x####### ##ÌÞ##èÞ###á###éˆ|##ˆ|ÿÿÿÿ##ˆ|{#ˆ|»#ˆ| #ß###Rˆ|Dß##ä#######Ô#######ß###Tˆ|Dß##Ô###############àß## ###ÔWhôˆß##¡Wˆ| xà######C__HAZ~1#TXT###Àøûýˆ##%#T#%#,â##U_ˆ|j!ˆ|#üýˆˆ_ˆ|øûýˆ##%######à##ìß## ß## #######ðß##ÍUˆ|Èß##Ȳˆ|ìß##äß##Tà## á##############Èâ############## language called ˆC with Classesˆ. Rick Mascitti suggested the name C++.Event Year DescriptionC with Classes 1979-1983 Adding classes with a preprocessorEvolution of C++ 1882-1985 First Commercial releaseRelease 2.0 1985-1988 Early Commercial useGrowth in Use 1987 Large Scale UseStandardization 1988Basic Feature of C++1. It is the super set/extension of C language, it supports almost every feature of C language, additionally it has itsown distinguish features.2. C++ is a general- purpose object oriented programming language.3. C++ is case sensitive language. 4. C++ is a language of few words.5. Almost every statement is terminated with semicolon.6. C++ is statement-oriented language.7. Every C++ language program has a extension .cpp or .cxx or .C8. Require explicit inclusion of related header file.Advance Features of C++1. Classes and Objects.2. Derived Classes.3. Private/public access control.4. Constructors and Destructors.5. Friend classes. 6. Inline function.7. Default argument.8. Overloading of operators..2Major Steps In C++ Program DevelopmentC++ programs typically go through several phases to be executed.ˆ Editing. The first phase consists of editing a file. This is accomplished with an editor program. The programmertypes a C++ program with the editor and makes the correction if necessary. The program is then often stored onsecondary storage device such as a disk.ˆ Compile. In this phase the programmer gives the command to compile the program. The compiler translates the C++ program, into object code. In C++ system, a Preprocessor program executes automatically before thecompilerˆs translation phase begins. The C++ preprocessor obeys special commands called preprocessordirectives which indicates that certain manipulation usually are to be performed on the program before thecompilation.ˆLinking. The file generated by the compiler is not a pure executable file so it cannot be executed by the computedirectly. Rather special program called the Linker is required that link the intermediate file with library routinesstored in a files with the .lib extension. After linking the intermediate file the linker generate the executable file(.exe) that can be execute by computer.ˆ Executing After the successful compilation and linking of program we receive the executable file that can beexecuted by the user.The layout/Structure of C++ ProgramsThe general form of a C++ program is as follows preprocessor directivesglobal declarationsclass definitionmain() {local variables to function main ;statements associated with function main ;} f1(){ local variables to function1 ;Statements associated with function1;} f2(){local variables to function f2 ;statements associated with function 2 ;} BASIC COMPONENTS OF C++ PROGAMVARIABLE Variable may be the most fundamental aspect of any computer language. A variable is a space in thecomputerˆs memory set aside for a certain kind of data and given a name for easy reference. Variables are used so thatthe same space in memory can hold different values at different times. Before using the variable it is necessary tocreate it with the proper command.There are several issues associated with the variable:1. Name/Length of variable (Naming rules).2. Type of variables.3. How to create.4. How to take
  • 11. input and output in the variable.Name/Length of variable (Naming rules)ˆ First character of the variable must be alphabet (a to z| A to Z) or underscore, while the remaining may bedigits, alphabet or underscore.ˆ No blank is allowed within a variable name.ˆ In some compiler the length of the variable is 8 characters, some compilers allow variable names whoselength could be up to 40 or 256 character, but the latest compiler impose no restriction on the length ofthe variable name.Example of Valid Variable Name:Age fname _abc _123 age123Example of Invalid Variable Name:9num age$.3Type of variables While declaring the variable it is necessary to specify its type.DATA TYPE DESCRIPTION SIZE RANGE signed int Store integer values with nofractional part2 bytes -32768 to32768 unsigned int Store integer values with nofractional part2 bytes 0 to 65535singed long Store large integer values with nofractional part4 bytes -2147483848to 2147483647unsigned longlongStore large integer values with nofractional part4 bytes 0 to4294967295float Store float value 4 bytes -3.4e38 to3.4e387 mantissa double Store large float value 8bytes-1.7e308 to1.7e30815 mantissalong double Store very large float value 10bytes-3.4e4932 to+1.1e493219 mantissachar Store single quote enclosed withinthe quotes1 byte----Creating Variableˆ int age;ˆ int age = 5;ˆ float profit = 78.56;ˆ char grade = ˆAˆ;ˆ int a,b,c;ˆ int a = 5, b = 7, c = 9;Displaying the content of VariableThe identifier cout is used for displaying the value of variable and other messages. cout is actually an object. It ispredefined in C++ to correspond to the standard output stream. A stream is a system that refers to a flow of data. Thestandard output stream normally flows to the screen display. With cout and operator << (insertion or put to operator) is used. It directs the content of the variable on its right to the object on its left. Necessary information about cout isincluded in iostream.h file. Program1: Display the contents of the variable.# include <iostream.h>void main(void){int a;a = 5;cout << a;} Program2:# include <iostream.h>void main(void) {int a;a = 5;cout << ˆvalue of a is ˆ;cout << a; // or cout << ˆvalue of a is ˆ << a;} .4CONSTANTS Constant is an identifier having a value that cannot be during the execution of program.Syntax:const type name = value;For instance:const float g = 9.8;Example: Read mass and calculate the weight.# include <iostream.h># include <conio.h>void main(void){const float gravity = 9.8;float mass, weight; cout << "Enter Mass : " ;cin >> mass;weight = mass * gravity;cout << "Calculated Weight is " << weight;getch();} In C++ constants can also be specified using the preprocessor directive # define.Syntax:# define constant_name valueFor instance: # define gravity 9.8The endl Manipulator endl manipulator causes a linefeed to be inserted into the stream. Strictly speaking endl alsocauses the output buffer to be flushed, but this happens invisibly.COMMENTS. Comments are an important part of any program. They help the person writing the program andanyone who must read the source file. The compiler ignores comments. So they do not add to the executable file.Comments starts with a double slash // and terminate at the end of line. C++ also support C language comments thatbegin with the /* and ends with */.Taking Input In Variables:To read the data in variable, cin object is used. The cin is predefined in C++ to correspond input stream. This streamdata represent data coming from the keyboard. The >> is the extraction or get from operator is used with cin object.Its takes the value from the stream objects on its left and places it in the variable on its right.OPERATORSArithmetic Operators.Assignment Operator.Relational Operators.Increment/Decrement Operators Logical Operators / Boolean OperatorsArithmetic Operators Operators are symbols that perform some particular action on operands.+ - * / %Program1 Read temperature in Fahrenheit and Convert in into Celsius.# include <iostream.h># include <conio.h>void main(void){int farsen, cel;clrscr(); // associate header file is conio.hcout << "Enter Temperature ";cin >> faren;cel = (faren ˆ 32) * 5 / 9; or f=(c*9/5)+32cout << "Equivalent Temperature In Celsius Is ˆ << cel;getch();} .5Program1 Read three numeric values in int type variables using one cin.# include <iostream.h># include <conio.h>void main(void){int n1,n2,n3; clrscr(); // associate header file is conio.hcout << "Three Numeric Values ";cin >> n1 >> n2 >> n3;clrscr();cout << "First Value is " << n1 << endl<< "Second Value is " << n2 << endl<< "Third Value is " << n3;getch();} .Arithmetic Assignment Operator If we compare a C program with a program with a similar purpose written inanother language, you may well find that the C source file is shorter. One reason for this is that C has severaloperators that can compress often-used programming such as the arithmetic assignment operators, which combines anarithmetic operator, and an assignment operator and eliminates the
  • 12. repeated operand.+= Addition Assignment operator-= Subtraction Assignment operator*= Multiplication Assignment operator/= Division Assignment operator%= Remainder Assignment operatorFor instance:A = A + 1; can be written as A += 1;B = B * 5; can be written as A *= 5;Increment & Decrement OperatorsIncrement and decrement operators are used to add 1 or subtract 1 from the value of the variable respectively.For instance:A = A +1; or A += 1; or A++; or ++A;A = A -1; or A -= 1; or or A--; or --A;Increment and decrement operators can be used in two ways:Prefix formPostfix formIn prefix form the operator precedes the variable; and as a postfix, meaning that the operator follow the variable. Example1:int A,B;A = 5;B = A++; /* B becomes 5 and A becomes 6 */Example2:int A,B;A = 5;B = ++A; /* B becomes 6 and A becomes 6 */.6Relational Operators Relational operators are the special type of operators used for comparing two values.Relational operators are used with loops and decisions. These Constructs require the program to ask questions aboutthe relationship between operands. Relational Operator Meanings< Less than> Greater than<= Less than or equal to>= Greater than or equal to== Equal to!= Not equal toExample:#include <iostream.h># include <conio.h>void main(void){int a,b;a = 5;b = 7;clrscr();cout << "A == B " << (a == b);cout << "nA > B " << (a > b);cout << "nA != B " << (a != b); getch();} Concept Of ManipulatorsProgram1# include <conio.h># include <iostream.h>void main(void){int a =175;clrscr();cout << "Value of A Is" << a << "Only";getch();} Program2# include <conio.h># include <iostream.h># include <iomanip.h>void main(void){int a =175;clrscr();cout << "Value Of A is"<< setw(5) << a<< "Only"; // Output: Value of A is 175Onlyˆgetch();} setw() Manipulator. Manipulators are the operators used with insertion operator << for controlling (modifying) theoutput generated by the C++ program. setw() is a manipulator that specifies that the next value be printed in aspecified width, and the value will be right justified in the field by default..7Program3# include <conio.h># include <iostream.h># include <iomanip.h>void main(void){int a =175;clrscr(); cout << "Value Of A is"<< setfill('#')<< setw(5) << a<< "Only";getch();} setfill() Manipulator. setfill() manipulator takes a single character as an argument and causes this character to besubstituted for spaces in the empty part of the field.Program4# include <conio.h># include <iostream.h># include <iomanip.h>void main(void){int a =175;clrscr();cout << "Value Of A is"<< setiosflags(ios::left)<< setw(5) << a<< "Only";getch();} setiosflags() Manipulator. It is a manipulator by which we can justify text output the output. Type CastingProgram# include <conio.h># include <iostream.h># include <iomanip.h>void main(void){float num;int intpart;clrscr();cout << "Enter Float Number : " ;cin >> num;intpart = (int) num;cout << "Integer Part is : " << intpart;cout << "nFractional Part is : " << setprecision(5)<< (num - intpart); getch();} .8Control Structure Any well-structured program is consist of three structures:ˆ Sequence Structure.ˆ Selection/Conditional Structure.ˆ Repetition Structure.Sequence Structure It is the simplest structure in which the statements are executed in the order in which they areexecuted. Conditional/Selection Structure Selection of one or multiple statements out of several statements depending uponsome criteria is called selection structure. In C++ language there are different types of conditional structures:1. if structure.2. if else structure.3. switch structure.4. conditional operator.if statement This is single selection structure used for selecting the single or multiple statements if the definedcondition is hold, otherwise the statement(s) is skipped, and the control is transfer to the next statement(s) of theprogram. Syntax of an if statement is:if( condition )statementExample: Check the either year is leap, if so display message ˆLEAP YEAR ˆ, otherwise doesnˆt display any message.# include <conio.h># include <iostream.h>void main(void){int year; clrscr();cout << ˆEnter Yearˆ;cin >> yearif (num % 2 == 0 )cout << ˆLEAP YEARˆ;} Program: Write a program that read the data in five variables, and find the largest value.# include <iostream.h># include <conio.h>void main(void){int n1,n2,n3,n4,n5,large;clrscr();cout << "Enter First Number : "; cin >> n1;cout << "Enter Second Number : "; cin >> n2;cout << "Enter Third Number : "; cin >> n3; cout << "Enter Forth Number : "; cin >> n4;cout << "Enter Fifth Number : "; cin >> n5;large = n1;if (n2 > large) large = n2;if (n3 > large) large = n3;if (n4 > large) large = n4;if (n5 > large) large = n5;cout << "Largest Value is " << large;getch();.9} Program Read one numeric value (of 4 digits), and check either the number is palindrome or not.# include <iostream.h># include <conio.h>void main(void){int num,temp;int d4,d3,d2,d1;clrscr();cout << "Enter 4 Digit ";cin >>
  • 13. num;temp = num;d4 = num % 10;num = (num-d4) / 10;d3 = num % 10;num = (num - d3) / 10;d2 = num % 10;num = (num - d2) / 10;d1 = num ;num = temp;temp = d4 * 1000 + d3 * 100 + d2 * 10 + d1;if (num == temp)cout << "Number is Palindrome"; elsecout << "Number is Not Palindrome";getch();} Nested if Statement If the single selection structure ˆif statementˆ is written inside anther single selection structurethen it is called nested single selection structure or nested if structure. The internal if structure is totally dependedupon external loop. For instance:if (condition){if (condition){} } Program# include <iostream.h># include <conio.h>void main(void){int num;clrscr();cout << "Enter Number ";cin >> num;if (num >= 100){if (num <= 200){cout << "Number Lies Between 100 to 200";} } getch();} .10Example: Check either the input character is capital alphabet (using nested if)# include <conio.h># include <iostream.h>void main(void){char ch; clrscr();cout << "Enter any character : ";ch = getch();if (ch >= 65 )if (ch <= 90)cout << "nCapital Alphabet is pressed!";} isalpha() It is used to check an ASCII character is alphabet or not.if ( isalpha(ch) ) cout << ˆInput Symbol is Alphabet!ˆ;isdigit() It is used to check an ASCII character is digit or not. isalnum() It is used to check an ASCII character is alphanumeric or not. isupper() It is used to check an ASCII character is upper case or not.islower() It is used to check an ASCII character is lower case or not.isspace() It is used to check an ASCII character is punctuation or not.Necessary information for all above macroˆs is included in ˆctype.hˆExample: Check either the input symbol is alphabet or not (using isalpha() )# include <iostream.h># include <conio.h># include <ctype.h>void main(void){char ch;clrscr();cout << ˆEnter Character ˆ;ch = getch();if ( isalpha(ch) )cout << ˆnInput Character is Alphabet ˆ;} if else statementIt is a double selection structure, used for executing the statement(s) if the defined condition is satisfied, otherwiseanother block of statement(s) will be executed.Syntax:if (condition)statementelsestatementorif (condition){ statement} else{statement} .11Example: Basic pay and grade is input from the keyboard, write a program that calculate the net pay, afteradding bonus to the basic pay. If the grade of employer is seventeen or above then the bonus is 500 otherwise the bonus is 300.void main(void){float bpay,npay,bonus;int grade; clrscr();cout << "Enter Bpay ";cin >> bpay;cout << ˆEnter Ur Grade ˆ;cin >> grade;if (grade >= 17)bonus = 500;elsebonus = 300;npay = bpay + bonus; printf("nCalculated Pay is %f ", npay);getch(); } else if statementThis statement is used when the program has several blocks of statement(s) and we want to execute one blockdepending upon some condition. If the first condition is true then the statements following the first block will beexecuted, otherwise the second block will be checked and if it is satisfied then the statements following it will beexecuted otherwise the next condition will be checked in the same way and some on.Syntax:if (condition){statement} else if (condition){ statement} else{statement} Program Read one numeric value representing the speed of a vehicle, and display the message, depending upon thespeed of the vehicle.# include <iostream.h># include <conio.h>void main(void){int speed;clrscr();cout << "Enter Speed : ";cin >> speed;if (speed > 200 )cout << "Too Fast!";else if (speed > 150)cout << "Quit Fast!";else if (speed > 100)cout << "Fast";else if (speed > 50)cout << "Normal";elsecout << "Slow";getch(); } .12Example: read the data in two integer variables and one character variable, and perform the arithmetic operation oninteger values, depending upon the value of character variable.# include <iostream.h># include <conio.h>void main(void){int n1,n2;char ch;clrscr();cout << "Enter First Number : ";cin >> n1;cout << "Enter First Number : ";cin >> n2;cout << "Enter Operator : ";ch = getche();cout << endl;if (ch == '+')cout << "Result is %d " << (n1 + n2);else if (ch == '-')cout << "Result is %d " << (n1 - n2);else if (ch == '*')cout << "Result is %d " << (n1 * n2);else if (ch == '/')cout << "Result is %d " << (n1 / n2);elsecout << "Invalid Value ";getch();} LOGICAL OPERATORLogical operators are the special type of operator use to condense and clarify the complicated selection structures aswell as other constructions.Three main logical operators are:1 AND &&2 OR ||3 NOT ! AND It is a logical operator that based on the multiplication. It takes two conditions and return true if both theconditions are true, if any of the condition is false, then it return false.OR It is a logical operator that based on addition. It takes two conditions, and return true if any of the condition istrue, if both the conditions are false then it return false.NOT It is a logical that base on the complement. It takes one expression, and negate (reverse) its value.
  • 14. Example:NOT TRUE = FALSENOT FALSE = TRUE.13Example: Using OR operators# include <iostream.h># include <conio.h>void main(void){int n1,n2;char ch;clrscr();cout << "Enter First Number : ";cin >> n1cout << "Enter First Number : ";cin >> n2; cout << "Enter Operator + - * / : ";ch = getche();cout << endl;if (ch == '+') cout << "Result is %d " << (n1 + n2);else if (ch == '-' || ch == ˆ_ˆ )cout << "Result is %d " << (n1 - n2);else if (ch == '*' || ch == ˆxˆ || ch == ˆXˆ)cout << "Result is %d " << (n1 * n2);else if (ch == '/' || ch == ˆˆ )cout << "Result is %d " << (n1 / n2);elsecout << "Invalid Value ";getch();} Example: Using AND operatorsvoid main(void){char ch;clrscr();printf("Enter Character : ");ch = getche();printf("n");if (ch >= 48 && ch <= 57)printf("Digit is presses!");else if (ch >= 65 && ch <= 90)printf("Capital alphabet is pressed"); else if (ch >= 97 && ch <= 122)printf("Small alphabet is pressed");else printf("Any other character is pressed!");getch();} Example: Using NOT operators, check either the input number is 1 or not# include <iostream.h># include <conio.h>void main(void){int num;clrscr();cout << "Enter Number : ";cin >> num; if (!(num == 1))cout << "Input Number is other than 1 ";elsecout << "Input Number is 1";getch(); } .14Switch StatementSwitch is a multiple selection structure and it is similar to the else-if construct but has more flexibility and a clearerformat.It is well structured, but can only be used in certain cases where; Only one variable is tested; all branches must dependon the value of that variable. The variable must be an integral type. (int, long, short or char).# include <iostream.h># include <conio.h>void main(void){int num;clrscr();cout << "Enter Number : ";cin >> num;switch(num){case 1:cout << "One is pressed!";break; case 2:cout << "Two is pressed!";break;case 3:cout << "Three is pressed!";break; case 4:cout << "Four is pressed!";case 5:cout << "Five is pressed!";break; default:printf("Any Other value is pressed!");} getch();} CONDITIONAL OPERATORIt is the short form of if-else construct. The conditional operator is also some times called the ternary operator sincethey take three arguments.Syntax: expression1 ? expression2 : expression3if the expression 1 is true (that is if its value is non zero), then the value returned will be expression2 otherwise thevalue return will be expression3Example: Find largest value# include <iostream.h># include <conio.h>void main(void){int num1, num2, large;clrscr(); cout << "Enter Number1 : ";cin >> num1;cout << "Enter Number2 : ";cin >> num2 large = (num1 > num2) ? num1 : num2;cout << "Largest Value is " << large; getch();} .15Example: Find the absolute value of an integer variable.# include <iostream.h># include <conio.h>void main(void){int num, abs;clrscr();cout << "Enter Number : ";cin >> num;abs = (num < 0) ? num * -1 : num;cout << "Absolute of ˆ << num << ˆ is ˆ << abs;getch();} LOOP The default order of execution in a C++ program is top-down. Execution starts at the beginning of the main() functionand progresses, statement by statement, until the end of main() is reached. However, this order is rarely encounteredin real C++ programs. The C++ language includes a variety of program control constructs that let you control theorder of program execution, one of which is a loop structure.Loop is one of the most important control structure uses for executing the statement(s) several numbers of times.Loop is also called Iteration Structure.C++ gives you a choice of three types of loopˆ for loopˆ while loopˆ do whilefor loop The for loop is frequently used, usually where the loop will be traversed a fixed number of times. A forstatement has the following structure:for ( initial; condition; increment )statement;initial, condition, and increment are all C++ expressions, and statement is a single or compound C++ statement. Whena for statement is encountered during program execution, the following events occur:1. The expression initial is evaluated. Initial is usually an assignment statement that sets a variable to aparticular value.2. The expression condition is evaluated. Condition is typically a relational expression.3. If condition evaluates to false (that is, as zero), the for statement terminates, and execution passes to the firststatement following statement.4. If condition evaluates to true (that is, as nonzero), the C++ statement(s) in statement are executed.5. The expression increment is evaluated, and execution returns to step 2.Example: Read the integer number and find its factorial.# include <iostream.h># include <conio.h>void main(void){int a, num, fact;clrscr();cout << "Enter Number : ";cin >> num;fact = 1;for(a=1;a<=num;a++)fact = fact * a;cout << "Factorial of " << num << ˆ is ˆ << fact; getch();} .16Example: Check either the input number is prime or not.# include <iostream.h># include <conio.h>void main(void){int a, num, div;clrscr();cout << "Enter Number : ";cin >> num;div = 0;for(a=1;a<=num;a+
  • 15. +){if (num % a == 0)div = div + 1;} if (div <= 2)cout << ˆPrime number" << num; elsecout << ˆNot a prime number" << num;getch();} break statementsWe often come across situations where we want to jump out of a loop instantly, without to get back to the conditionaltest. The keyword break allows us to do this. When the keyword break is encountered inside any C++ loop, controlautomatically passes to the first statement after the loop. A break is usually associated with an if statement.Example: A program that the series of number 1 2 3 4 5# include <iostream.h># include <conio.h>void main(void){int a;clrscr();for(a=1;a<=10;a++) {cout << endl << a;if (a == 5) break;} } continue statementIn some programming situations we want to take the control the beginning of the loop, bypassing the statementsinside the loop, which have not yet been executed. The keyword continue is encountered inside any C++ loop,control automatically passes to the beginning of the loop. A continue is usually associated with an if statement. Example: A program that the series of number 1 2 3 4 5 7 8 9 10# include <iostream.h># include <conio.h>void main(void){int a;clrscr();for(a=1; a <= 10; a++){if ( a = = 6 )continue;cout << a;} } .17Nested For Loop When the for loop is written inside another for loop, then it is called nested for loop.Example: A program that display the series of numbers1 2 3 4 5 6 7 8 9 102 4 6 8 10 12 14 16 18 203 6 ˆ 304 8 12ˆ 405 10 15ˆ 50# include <iostream.h># include <conio.h># include <iomanip.h>void main(void){int a, b;clrscr();for(a=1; a <= 5; a++){ for(b=1;b<=10;b++)cout << setw(5) << a*b;cout << endl;} getch();} Example: Display the stars in diamond shape.# include <iostream.h># include <conio.h>void main(void){int a, b;clrscr();for(a=1; a <= 20; a+= 2){gotoxy(40-a/2,2+a); for(b=1;b<=a;b++)cout << "*";} getch();} while loop The while statement, It is also called an unexpected condition loop used to executes a block of statements as long as a specified condition is true. The while statement has the following form:Syntax:While (condition) statementCondition is any C++ expression, and statement is a single or compound C++ statement. When program executionreaches a while statement, the following events occur:1. The expression condition is evaluated.2. If condition evaluates to false (that is, zero), the while statement terminates, and execution passes to the firststatement following statement.3. If condition evaluates to true (that is, nonzero), the C++ statement(s) in statement are executed.4. Execution returns to step 1..18Example A program that read the characters from the keyboard and display it in the capital, and count how manyvowels characters are pressed.# include <iostream.h># include <conio.h># include <stdio.h># include <ctype.h>void main(void){char ch; int total = 0;int vowels = 0;clrscr();cout << "Enter Text " << endl;while ((ch = getch()) != 'r'){ch = toupper(ch);printf("%c", ch );if ( ch == 'A' || ch == 'E' || ch == 'I' || ch == 'O' || ch == 'U')vowels++;total++;} cout << endl<< "Total Character(s) " << total << endl<< "Vowels " << vowels;getch();} Do while loop The last of the three loop in C++ is the do-while loop. This loop is very similar to the while loop- thedifference is the place where the condition is tested. The while tests the condition before executing any of thestatements within the while loop. Whereas do-while tests the condition after having executed the statements within aloop.This means that do-while would execute its execution at least once, even if the condition fails for the first time itself.The while, on the other hand will not execute its execution if the conditions fails for the first time. Syntax:do{} while (condition);Example: Display the numbers 1 2 3 4 ˆ 10void main(void){int a;a = 1;clrscr();do{printf("%dn",a);a++;} while (a <= 10); getch();} .19Example Convert the decimal number into binary/octal/hexa numbers# include <iostream.h># include <conio.h># include <stdio.h># include <ctype.h># include <iomanip.h>void main(void){int num=0; // Store Input Valuesint a; // Counter Variableint base = 1; // Control the baseint temp; // Store the value temporarilyint pos; // Control the position of binary outputchar ch; // Store the input digitclrscr();gotoxy(20,3);cout << "Enter 4 Digits Number ";for(a=1 ; a<=4 ; ){ch = getch(); // Take the input invisiblyif (!(isdigit(ch)) ) // Loop if input is not digitcontinue;gotoxy(50+a,3);printf("%c", ch); // display input digitch = ch - 48; // convert digit into pure digitnum = num * base + ch; // Add input digit with previous digitsbase = 10; // Set the base by 10temp = num; gotoxy(4,5+a*2);printf("Decimal : %6d ",temp);printf(" Hexa : %6X ",temp); printf(" Octal : %6o ",temp);printf(" Binary : ");pos = 75;do{int rem;rem = t emp % 2 ;// display binary digitgotoxy(pos--,5+a * 2);printf("%1d", rem);temp = (temp-rem) / 2;} while (temp != 0);a++; // Add one in counter variable} // end of the for loopgetch();} .20Function A function is a named, independent section of
  • 16. C++ code that performs a specific task and optionally returnsa value to the calling program. Functions are easy to use; they allow complicated programs to divide into smallblocks, each of which is easier to write, read, and maintain. Functions are normally classified into two categories. Built in Functions.. Programmer Defined FunctionsBuilt in functions are those functions that are already developed and available with the C++ compiler, standard headerfiles store necessary information about these functions.Programmer defined functions are those function that are developed by the programmer itself. Function can acceptargument(s), as well as it can return one value to the calling program. As far as the arguments and return value areconcerned we classify function in four categories:. Simple function (No Argument, No Return).. Return Value function.. Argument function.. Return & Argument function.There are three elements involved in using functions:. Function Prototype/ Declaration.. Function Definition.. Function CallFunction Prototype Function prototype is a single statement comes before the main() function. Function prototypeprovides the following information to the compiler. Function prototype always terminates with semicolon.. Name of the function.. List and arrangement of argument(s) accepts by the functions. Function can zero, one or morearguments..Specify either the function can return any value to the calling program, function can return zero(no value) or one value to the program.For Instance:void func1(void);Above line indicates that we have declared a function ˆfunc1ˆ, that accept no value from the calling program; as wellit will return no value to the calling program.void func2(int, float); Above statement indicates that we have declare a function ˆfunc1ˆ, that accept two values from the calling program,in which the first value is of type integer and the second is of type float. Whereas it will returns no value to a calling programfloat func3(int, float);Above statement indicates that we have declare a function ˆfunc1ˆ, that accept two values from the calling program,in which the first value is of type integer and the second is of type float. Whereas it will returns one value of type float.Function Definition It is the actual block of code that contains all statements, that will be execute, when the functionis call. Function definition comes at the end of main() function. Function definition is similar to the definition of themain() function.For instance:void func1(void){ˆ} Function Call It is statement that invokes the function. When the function is invoked; it executes all the statementswritten inside the definition of that function..21Simple Function A function that do not accept any value as well as do not return any value.Example: A program that display the line of stars.# include <iostream.h># include <conio.h>void line(void);void main(void) { clrscr();cout << ˆHello Worldˆ;line();cout << ˆHello Worldˆ;line();} void line(void){ int a;cout << endl;for(a=1;a<=80;a++)cout << ˆ*ˆ;} Argument Functions A function that accept the value(s).Example: A program that displays the line of any character passed as argument.# include <iostream.h># include <conio.h>void line(char);void main(void){ clrscr();cout << "Hello World"; line('*');cout << "University Of Balochistan"; line('+');} void line(char ch){int a;cout << "n"; for(a=1;a<=80;a++)cout << ch;} Example: A program that displays the line of any character passed as argument, where the length of the line isalso specified as an argument.# include <iostream.h># include <conio.h>void line(int, char);void main(void){clrscr();cout << "Hello World";line(50,'*');cout << "University Of Balochistan";line(70,'+');} void line(int num, char ch){int a;cout << "n"; for(a=1;a<=num;a++)cout << ch;cout << "n";} .22Argument & Return Function A function that accept value(s) as well as return one value.Example: A function that accepts two arguments and return the largest value.# include <iostream.h># include <conio.h>int findlarge(int, int);void main(void){int res, a = 27, b = 90;clrscr();res = findlarge(a,b);cout << "nLargest Value is " << res;} int findlarge(int num1,int num2){int temp;if (num1 > num2)temp = num1;elsetemp = num2;return temp;} Passing Arguments To FunctionsAn argument is a piece of data passed from a program to the function. Arguments allow a function to operate withdifferent values. In C++ the arguments can be passed to function in two ways:ˆ Pass by value.ˆ Pass by reference.Pass By Value When the argument is pass by value, a copy of the argumentˆs value is made and passed to the called function. Changes to the copy do not affect the original variables in the caller. This prevents the accidental sideeffects. Example:# include <conio.h># include <iostream.h>void change(int, int);void main(void){int a,b;a = 5;b = 7; clrscr();cout << "A : " << a << " B : " << b;change(a,b);cout << "nA : " << a << " B : " << b;getch();} void change(int a, int b){a = 15;b = 17;} Pass By
  • 17. Reference A reference provides an alias (different name) for a variable. When the arguments are passed byreference, instead of a values being passed to the function, a reference to the original is passed, with this feature thecaller gives the called function to the ability to directly access the callerˆs data, and to modify that data if the calledfunction so chooses. To indicate that a function parameter is passed by reference, simply follow the parameterˆs typein the function prototype by an ampersand (&) and use the same convention when listing the parameters type in thefunction header..23Example: # include <conio.h># include <iostream.h>void change(int&, int&);void main(void){ int a,b; a = 5;b = 7;clrscr();cout << "A : " << a << " B : " << b;change(a,b);cout << "nA : " << a << " B : " << b;getch(); } void change(int& a, int& b){ a = 15;b = 17;} Default Argument FunctionsIn C++ a function can be called without specifying all its arguments. For that purpose function definition mustprovide default values for those arguments that are not specified. If one argument is missing when the function iscalled, it is assumed to be last argument. In case of multiple arguments they must be the trailing arguments.Example:# include <conio.h># include <iostream.h>void display(int=10 , int =20, int=30 );void main(void){clrscr();display(60,70,80); // show 60 70 80display(100,200); // show 100 200 30display(300); // show 300 20 30display(); // show 10 20 30getch();} void display(int a, int b, int c){ cout << endl << "A : " << a << " B : " << b << " C : " << c;} Inline FunctionImplementing a program as a set of functions is good from a software-engineering standpoint, but function callinvolve execution time overhead. C++ provides inline functions to help reduce function call overhead (specially forsmall functions). The qualifier inline before a function returns type in the function definition advices the compiler togenerate a copy of the functions code in place (when appropriate) to avoid a function call. The tradeoff is thatmultiple copies of the function code are inserted in the program rather than having a single copy of the function towhich control is passed each time the function is called. The compiler can ignore the inline qualifier and typicallydoes so for all but the smallest functions.Example: # include <conio.h> # include <iostream.h>inline int cube(int n){ return n * n * n;} void main(void){ int num,res;clrscr();cout << "Enter Number : " ;cin >> num;res = cube(num);cout << "Result is : " << res;getch(); } .24Overloaded FunctionsC++ enables several functions of the same name to be defined as long as these functions have different sets ofparameters. This capability is called function overloading. When an overloaded function is called, the C++ compilerselects the proper function by examining the number, types and order of the arguments in the call. Functionoverloading is commonly used to create several functions of the same name that perform similar tasks, but ondifferent data types. Overload functions are distinguished by their signatures (a signature is a combination of afunction name and its parameter types). The function encodes each function identifier with the number and the typesof its parameter (sometimes referred to as name mangling or name decoration) to enable type-safety linkage. Typesafe linkage ensures that the proper overload function is called.Example:# include <conio.h># include <iostream.h>void line(void);void line(char);void line(char, int);void main(void){clrscr();line();line('+');line('#',70);getch();} void line(void){int a;cout << endl;for(a=1;a<=80;a++)cout << "*";} void line(char ch){int a;cout << endl;for(a=1;a<=80;a++)cout << ch;} void line(char ch, int num){int a;cout << endl;for(a=1;a<=num;a++)cout << ch;} Variables and Storage ClassesThe storage class of a variable determines which parts of the program can access it and how long it stays in existence.As far as storage classes are concerned, the variables are classified in three main categories:ˆ Automatic variables.ˆ External variables.ˆ Static variables..25Automatic Variables. Variables defined within a function body are called automatic variables or local variables. Akeyword auto can be used to specify an automatic variable.void main(void){auto int age;auto float fee;} The word auto is rarely used since this is the default.Lifetime An automatic variable is no created until the function in which it is defined is called. When the control istransferred to the function, then all its containing variables are created and memory space is set aside for them, laterwhen the called function is terminated the control is return back to the calling program, the variables are destroyedand their values are lost.The time period between the creation and destruction of a variable is called its lifetime (duration). The lifetime if anautomatic variable coincides with the time when the function in
  • 18. which it is defined is executing. The idea behindlimiting lifetime of variables is to save memory space. If a function is not executing, the variables it uses duringexecution are presumably not needed. Removing them free up memory that can be used by other functions.Visibility A variables visibility describes the locations within a program from which it can be accessed. It can bereferred to in statements in some parts of the program, but in others attempts to access it lead to an unknown variableerror message. The word scope is also used to describe visibility. The scope of a variable is that part of the programwhere the variable is visible. Automatic variables are only visible within the function in which they are defined.# include <iostream.h># include <conio.h>void fun1(void);void main(void){int b = 5;fun1();} void fun1(void){int a = 7;cout << ˆA : ˆ << a;cout << endl << ˆB : ˆ << b;} Initialization When an automatic variable is created, the compiler does not try to initialize it. Thus it will start off withan arbitrary value, which may be 0 but probably will be something else. If we want it initialized, you must do itexplicitly.int a = 45;Example:# include <iostream.h>void main(void){int a;cout << ˆA : ˆ << a; // Any garbage value} .26External Variables. External variable is a major storage and defined outside any function. An external function isvisible to all the functions in a program. External variables are also called global variables, since they are known byall the functions in a program.If external variable is not initialized explicitly then it is initialized automatically to 0 when it is created. The externalexist for the life of the program and visible int the file in which they are defined, starting at the point where they aredefined.Example: # include <iostream.h># include <conio.h>int data;void fun1(void);void fun2(void);void fun3(void);void fun4(void);void main(void){clrscr();fun1(); // display 0 fun2(); // display 4fun3(); // display 20fun4(); // display 5cout << endl << "Data is " << data; // display 5getch();} void fun1(void){cout << endl << "Data is " << data;data++;} void fun2(void){data += 3;cout << endl << "Data is " << data;data++;} void fun3(void){int data=20;cout << endl << "Data is " << data; data++;} void fun4(void){int data=20;cout << endl << "Data is " << ::data;data++; } .27Static Variables. A static variable has the visibility of a local variable; its lifetime is similar to that of an externalvariable, except that it does not come into existence until the first call to the function containing it. Thereafter itremains in existence for the life of the program. The static variable is initialized only once-the first time their functionis called. They are not called on subsequent calls to the function as ordinary automatic variables are.Example: Normal variables initialization.# include <iostream.h># include <conio.h>void fun(int);void main(void){clrscr();fun(5); // display 5 fun(7); // display 7getch();void fun(int a){int res=0;res = res + a;cout << endl << "Result is : " << res;} Example:# include <iostream.h># include <conio.h>int data;void fun(int);void main(void){clrscr();fun(5); // display 5fun(7); // display 12getch();} void fun(int a){static int res=0;res = res + a;cout << endl << "Result is : " << res;} .28Object Oriented Programming (Object and Class )OOP is relatively a new programming technique, in which the program is developed in the form of an object.ˆ Any real word entity is called an object.ˆ Anything having some properties (attributes) and functions (purposes) is called an object. By such definition wecan say that every thing in this universe is an object.For Example: Cup is an object.Cup has several properties:1. Color.2. Cost.3. Width.4. Height.5. Weight6. Material from which it is developed (Plastic, Marble).7. Design.8. Company.Cup has a several functions:1. Use for drinking tea.2. Use for drinking coffee.3. Use for drinking cold drinks.4. Use for shave.5. Use for washing car.6. Use as a decoration piece.ˆ Object is an encapsulation of data and other related routines. Placing data and functions together into a singleentity is the central idea of object-oriented programming. Objects are defined using a special structure called theclass. A class is a template used to define the structure of an object. A class is a user defined data type. Conceptof object-oriented programming was introduced to implement the information hiding. An object has the samerelationship to a class that a variable has to a data type. An object is said to be an instance of a class. Specifying & Using ClassProgram# include <iostream.h># include <conio.h>class student{private: int rno;int age;float fee;public:void assign_values(int mrno, int mage, float mfee){rno = mrno;age = mage;fee = mfee;} void get_input(void){ cout << endl << "Enter RNo : ";cin >> rno;cout << "Enter Age : ";cin >> age;cout << "Enter Fee : ";cin >> fee;} void display(void){cout << endl<< "Rno : " << rno
  • 19. << "Age : " << age<< "Fee : " << fee;} .29} ;void main(void){student s1,s2,s3; s1.assign_values(10,20,70.0);s2.get_input();s3.get_input();s1.display(); s2.display();s3.display();getch(); } Members of Class (Data & Functions)The class declaration starts with the keyword class, followed by the class name. The body of the class is delimited bybraces and terminated by semicolon. The class has two members:ˆ Data Member(s).ˆ Member Functions.The data items within a class are called data members (or sometimes called member data). There can be any numberof data members in a class. Functions that are included within a class are called Member Functions. Some languagessuch as Smalltalk the member functions are called methods. Some languages refer to calls to member functions as messages.private and publicA key feature of object-oriented programming is data hiding. Private data and functions can only be accessed fromwithin a class. Pubic data or functions on the other hand are accessible from outside the class. Accessing Members of ClassMembers of a class are accessed using the member access operators (the dot operator) and the arrow operator (->).The dot operator accesses a class member via the variable name for the object or via a reference to the object. Thearrow operator consisting of a minus sign (-) and greater than sign (>) with no intervening spaces- accesses a classmember via a pointer to the object.Member Functions Outside The ClassIn C++ it is allowed to define the Member function of the class outside its definition.Program# include <iostream.h># include <conio.h>class employee{private: int empid;int grade;int pay;public:void assign (int mempid, int mgrade, int mpay);void display(void);} ; void employee::assign(int mempid, int mgrade, int mpay){ empid = mempid;grade = mgrade;pay = mpay;} void employee::display(void){ cout << endl << "Employee ID : " << empid<< endl << "Grade : " << grade<< endl << "Pay " << pay; } void main(void){ employee e1, e2;clrscr();e1.assign(10,17,10000); e2.assign(20,18,15000);e1.display();e2.display();getch(); } .30Constructors When a class object its members can be initialized automatically without a separate call to a memberfunction. Automatic initialization is carried out using a special member function called a constructor. A constructor isa class member function with the same name as the class that is executed automatically whenever an object is created.Constructors cannot return any value.Example:# include <iostream.h># include <conio.h>void main(void){class customer{private:int cno; public:customer() // customer(): cno(0) { } {cno = 0;} void show(){cout << endl << "Counter Is " << cno;} } ;customer c1;clrscr();c1.show();getch();} Overloaded Constructors In C++ it is possible to overload the constructor to provide a variety of means forinitializing objects.Example: # include <iostream.h># include <conio.h>void main(void){class customer{private:int cno;public: customer(){cno = 0;} customer(int temp){cno = temp;} void show(){ cout << endl << "Counter Is " << cno;} } ;customer c1;customer c2(21);clrscr();c1.show(); c2.show();getch(); } .31Objects As Arguments Objects can be passed to the functions as the arguments.Example:# include <iostream.h>include <conio.h>void main(void){class income{private:int amount;public:income(){amount = 0;} income(int a){amount = a ;} void assign(int a){amount = a;} void show(){cout << endl << "Amount Is " << amount;} void add(income i1, income i2){amount = i1.amount + i2.amount;} } ;income d1;income d2(100);income d3;d3.assign(73);income d4;d4.add(d2,d3);clrscr();d4.show();getch();} .32Default Copy Constructors In C++ it is possible to initialize an object with another object of the same type, and wedonˆt need to create a special constructor for this; since it is already built into all classes and known as default copyconstructor.Example:# include <iostream.h># include <conio.h>void main(void){class biodata{private:int recno;int age;float pay; public:biodata(){recno = 0;age = 0;pay = 0.0;} biodata(int r, int a, float p){ recno = r;age = a;pay = p;} void display(){cout << endl << "Record No# " << recno << endl << "Age " << age<< endl << "Pay " << pay<< endl;} } ;biodata s1(10,25,12000);biodata s2(s1);biodata s3 = s1;clrscr();s1.display(); s2.display();s3.display();getch();} .33Destructors A destructor is a special member function of class. The name of the destructor for a class is the tilde (~)character followed by the class name. The destructor is the complement of the constructors. A classˆs destructor iscalled when an object is destroyed. The destructor does not actually destroy the object-it performs termination housekeeping before the system reclaims the objectˆs memory so that memory may be reused to new objects.A destructor receives no parameters and returns no value. A class may have only one destructor- destructoroverloading is not
  • 20. allowed.Example: # include <iostream.h># include <conio.h>class myclass{private: int rno;public: myclass(void){cout << endl << "Constructor With No Arguments Is Called";} myclass(int a){rno = a;cout << endl << "Constructor With One Argument Is Called"; } ~myclass(){cout << endl << "One Object Is Destroying"; } } ;void main(void){ clrscr();Myclass o1;Myclass o2(1);getch(); } Returning Objects From Functions In C++ it is possible to define a function that can return a value. Example: # include <iostream.h># include <conio.h>class my class{private int amount;public: myclass(void){amount = 0; } myclass(int a){amount = a; } myclass addvalues(myclass o1){ myclass temp;temp.amount = amount + o1.amount;return temp;} void display(void){cout << endl << "Value of Amount is " << amount ;} } ; void main(void){ clrscr();myclass o1(10);myclass o2(20);myclass o3;o3 = o1.addvalues(o2);o1.display();o2.display();o3.display();getch();} .34Static Class Data Each object contains its own separate data, if a data item in a class is declared as static, then onlyone such is created for the entire class, no matter how many objects there are. A static data item is useful when allobjects of the same class must share a common item of information.Example: # include <iostream.h># include <conio.h>class myclass{private: static int count;public: myclass(void){count++;} void display(void){cout << endl << "Value of Count is " << count ;} } ;int myclass::count=0;void main(void){clrscr();myclass o1;myclass o2;myclass o3;o1.display();o2.display();o3.display();getch();} Example:# include <iostream.h># include <conio.h>class myclass{private: int sno;static int count; public: myclass(void){count++;sno = count;} void display(void){cout << endl << "Value of SNo is " << sno ;} } ;int myclass::count=0;void main(void){clrscr(); myclass o1;myclass o2;myclass o3;o1.display();o2.display();o3.display();getch(); } .35ARRAYSArray is a data structure generally used for storing the large number of values having same type.i) Array is a set of finite, fixed and homogenous elements.ii) In array the multiple values are stored with single name reference, but a special integer number called theindex/subscript is used for referring the particular element of an array.iii) In C++ an array indexing starts at position 0. The elements of the array occupy adjacent locations in memory.iv) By using the array in a program it is necessary to declare it with the proper command.One Dimension Array An array whose each element is referred by a single array is known as one dimension array.Array Definition Like other variables, the array needs to be defined, so the compiler will know what kind ofarray, and how long an array, we want.Syntax: datatype arrayname[size];Example: int data[10];Here the int specifies the type of variable, just as it does with simple variables, andthe word data is the name of the array variable.The [10] tells the how many variables of type int will be in our array. Each ofseparate variables in the array is called an ˆelementˆ. The bracket tells the compilerthat we are dealing with an array.Referring to Individual Elements of the Array Once the array has been established, we need a way to referto its individual elements. This is done with subscripts, the number in bracket following the array nameSyntax: arrayname[element];Example:Data[5] = 26;Entering Data into the ArrayMethod1# include <iostream.h># include <conio.h>void main(void){ int temp[7];int avg; clrscr();cout << "Enter Temperature for Day 1 " ; cin >> temp[0];cout << "Enter Temperature for Day 2 " ; cin >> temp[1];cout << "Enter Temperature for Day 3 " ; cin >> temp[2];cout << "Enter Temperature for Day 4 " ; cin >> temp[3];cout << "Enter Temperature for Day 5 " ; cin >> temp[4];cout << "Enter Temperature for Day 6 " ; cin >> temp[5];cout << "Enter Temperature for Day 7 " ; cin >> temp[6];avg = temp[0] + temp[1] + temp[2] + temp[3] + temp[4] + temp[5] + temp[6];avg = avg / 7;cout << "Average Temperature is " << avg;getch();} Method2 # include <iostream.h># include <conio.h>void main(void){int temp[7];int avg; clrscr();for(int a =0;a<=6;a++){ cout << "Enter Temperature for Day 1 " ;cin >> temp[a];} avg = 0;for(a=0;a<=6;a++)avg += temp[a];avg = avg / 7;cout << "Average Temperature is " << avg;getch();} .36Program Find the largest value from the array.# include <iostream.h># include <conio.h>void main(void){int data[10];int large;clrscr();for(int a =0;a<=9;a++){cout << "Enter Temperature for Day 1 " ; cin >> data[a];} large = data[a];for(a=0;a<=9;a++)if (data[a] > large)large = data[a];cout << "Largest is " << large;getch();} Program Reverse the elements of the array# include <iostream.h># include <conio.h>void main(void){int data[10]; int a, temp;clrscr();for(a =0;a<=9;a++){cout << "Enter Temperature for Day 1 " ; cin >> data[a];} clrscr();cout << "Before Reverse" << endl ;for(a=0;a<=9;a++)cout << "Data " << a << " is " << data[a] << endl ;// Interchange the array elements for(a=0;a<=4;a++){temp = data[a];data[a] = data[9-a];data[9-a] = temp;} cout <<
  • 21. endl << "After Reverse" << endl ;for(a=0;a<=9;a++)cout << "Data " << a << " is " << data[a] << endl;getch();} Initializing Arrays In C++ language it is possible to assign the values to the elements of an array.Syntax:¾ datatype arrayname[size] = {value1, value2, value3ˆ valuen} ;For instance:int data[5] = {11,22,33,14,51} ;int data[5] = {0} ; // all the elements are initialized with a value 0Example:int data[5] = {10,40,30,5,11} ;.37Program Calculates the frequency of the numbers (varies from 0 to 9) input from the keyboard# include <iostream.h># include <conio.h># include <iomanip.h>void main(){ int data[20] = {0} ;int frequency[10] = {0} ;int a;clrscr();for(a=0;a<=19;a++){cout << "Enter Data (0-9) " ;cin >> data[a] ;} for(a=0;a<=19;a++){++frequency[data[a]];} clrscr();cout << endl << endl<< setw(20) << "Data"<< setw(20) << "Frequency"<< endl;for(a=0;a<=9;a++){cout << setw(20) << a<< setw(20) << frequency[a]<< endl; } getch();} Selection Sort Selection sort is one of the easiest way to sort the data. The basic idea of the selection sort is to findthe smallest element in the array and move it to the first position, then find the next smallest element and move it tothe second position, and continue this process until the next to the last position is filled. When the correct element isin the next to the last position, the sort is finished because the last element, which is the only one left, must be thelargest element.Program for selection sort# include <iostream.h># include <conio.h>void main(void){ int data[10];int a,b, index, temp;clrscr();for(a =0;a <= 9; a++){cout << "Enter Data " << a << " : ";cin >> data[a]; } for( a = 0 ; a <= 8 ; a++){index = a ;temp = data[a];for( b = a + 1; b <= 9 ; b++){ if ( temp > data[b]){ temp = data[b];index = b;} } data[index] = data[a];data[a] = temp; } clrscr();for(a=0;a<=9;a++)cout << "nData " << a << " is " << data[a];getch();} .38Passing Arrays To Functions To pass an array argument to a function; specify the name of the array without anybrackets.# include <iostream.h># include <conio.h>void input(int [], int n );void display(int [], int n);void main(void){int data[10];input(data,10);display(data, 10);getch();} void input(int array[], int size){clrscr();for(int a=0; a<size; a+ +){cout << "Enter Data " << a << " : " ;cin >> array[a];} } void display(int array[], int size){clrscr();for(int a=0; a<size; a++)cout << "Data " << a << " is " << array[a] << endl ;} Program Generates the frequency table.# include <iostream.h># include <conio.h># include <iomanip.h>void main(){int data[20] = {0} ;int frequency[10] = {0} ;int a;clrscr();for(a=0;a<=19;a++){cout << "Enter Data (0-9) " ;cin >> data[a] ;} for(a=0;a<=19;a++){++frequency[data[a]];} clrscr();cout << endl << endl<< setw(20) << "Data"<< setw(20) << "Frequency"<< endl;for(a=0;a<=9;a++){cout << setw(20) << a<< setw(20) << frequency[a]<< endl;} getch();} .39String The way a group of integers can be stored in an integer array, similarly a group of characters can be stored in acharacter array. In C++ language an array of characters is called a string. Programming languages to manipulate textsuch as words and sentences uses character arrays or strings. String constantcout << ˆHelloˆ;ˆHelloˆ is a string constant. That means the string itself is stored someplace in memory, but that it cannot bechanged. Each character occupies one byte of memory, and the last character of the string is the character ˆ0ˆcalled the null character, which indicates the end of the string.String Variable# include <conio.h># include <iostream.h>void main(void){char name[30];cout << ˆEnter Name : ˆ;cin >> name;cout << endl << ˆInput Name is ˆ << name;getch();} Note: The extraction operator >> uses any white space character to terminate entry of variable. So there is no way toenter a multiword string into a single array using >>Note: C/C++ does not support bound checking features.Avoiding Buffer Overflow In C++ there is no built in mechanism to keep a program from inserting array elements outside an array, but we can use the >> operator to limit the number of characters it places in an array.# include <conio.h># include <iostream.h># include <iomanip.h>void main(void){char name[30];cout << ˆEnter Name : ˆ;cin >> setw(30) >> name;cout << endl << ˆInput Name is ˆ << name;getch();} Reading Embedded Blanks cin.get() This member function allows to read text containing blanks.Syntax:cin.get(string_variable, MAX);Example:# include <conio.h># include <iostream.h>void main(void){char name[10];clrscr();cout << "Enter Name "; cin.get(name,10);clrscr();cout << endl << "Name is " << name;getch();} .40Reading Multiple Lines By using the third argument with cin.get() function, we can enter a string multiple lines.This argument specifies the character that tells the function to stop reading. The default value for this function is thenewline ( ˆnˆ) character by the default value can be override by the specified character.
  • 22. # include <conio.h># include <iostream.h>void main(void){ char text[10]; clrscr();cout << "Enter Text ";cin.get(text,10, ˆ#ˆ);clrscr();cout << endl << "Text is " << text;getch();} String Functionsstrlen() Use strlen to find the length of the a string in bytes, not counting the terminating null character. Itsassociated header file is string.hExample:# include <conio.h># include <iostream.h># include <string.h>void main(void){ char name[25];int len;clrscr(); cout << ˆEnter Name : ˆ;cin.get(name.25);len = strlen(name);cout << ˆnLength of ˆ << name << ˆ is ˆ << len; } strcpy() Use strcpy to copy one string to another. Its associated header file is string.hSyntax:strcpy(string1, string2); /* Copy string2 to string1 */Example:void main(void){ static char s1[10] = ˆHelloˆ;char s2[10];strcpy(s2,s1); } strcmpi() Use strcmpi() to compare strings and return an integer value.Syntax: strcmpi(string1, string2);The return value is zero if the two strings are identical. If string1 is less than sting2, the return value is lessthan zero, when string1 is greater than string2; it returns an integer value greater than zero, where thecomparison is case sensitive. Its associated header file string.hExample: Check whether 2 input strings are equal or not.# include <conio.h># include <iostream.h># include <string.h>void main(void){ char text1[25];char text2[25];int res;clrscr();cout << "Enter Text1 "; cin.get(text1,25);cout << "Enter Text2 ";cin.get(text2,25);res = strcmpi(text1,text2);if ( res == 0 )cout << ˆStrings R Equalˆ;elsecout << ˆStrings R Not Equalˆ;getch(); } .41strupr() Use to convert any lowercase letters in a string to uppercase, other characters in the strings are unaffected.Its associated header is string.hSyntax:strupr(string);Example:void main(void){ static char text[25] = ˆhello worldˆ;strupr(tex);} strlwr() Use to convert any uppercase letters in a string to lowercase, other characters in the strings are unaffected.Its associated header file is string.hSyntax:strlwr(string);Example: void main(void){static char text[25] = ˆhello worldˆ;strlwr(text);} strrev() Use strrev() to reverse the order of the characters in string. The terminating null character remains at thesame place. strrev() is normally used to check whether a string in palindrome. Its associated header file isstring.hSyntax: strrev(string);Example: Check either the input string is palindrome on not.# include <conio.h># include <iostream.h># include <string.h>void main(void){char text1[25];char text2[25];clrscr();cout << "Enter Text ";cin.get (text1,25); strcpy(text2,text1);strrev(text2);if ( strcmpi(text1,text2) == 0 )cout << ˆString Is Palindromeˆ;elsecout << ˆString is Not Palindrome";getch();} strcat() Use strcat to concatenate (append) one string to another. Its associated header file is string.hSyntax:strcat(string1, strzing2);Example:void main(void){char first[10] = ˆkaraˆ;char second[5] = ˆchiˆ;strcat(first,second); /* concatenate second with first */} .42Two Dimension Arrays: Two-dimension array (matrix) is an array whose each element is itself an array. In two-dimensionarray each element is referred by two index values, in which one represent the row position and the secondrepresent column position.Syntax for creating two-dimension arraydatatype arrayname[rows][columns];For instance:int data[3][4];Referring to Individual Elements of the 2D Array Once the array has been established, we need a way to refer toits individual elements. This is done with subscripts, the numbers in brackets following the array nameSyntax:arrayname[rowposition][columnposition]; Example:data[2][3] = 26;Method1: Entering data in 2D Array# include <iostream.h> # include <conio.h>void main(void){int data[2][3];cout << "Enter Data "; cin >> data[0][0];cout << "Enter Data "; cin >> data[0][1];cout << "Enter Data "; cin >> data[0][2];cout << "Enter Data "; cin >> data[1][0];cout << "Enter Data "; cin >> data[1][1];cout << "Enter Data "; cin >> data[1][2];} Method2: Entering data in 2D Array# include <iostream.h># include <conio.h># include <iomanip.h> void main(void){int data[2][3];int a,b;clrscr();for(a=0;a<=1;a++){ for(b=0;b<=2;b++){cout << "Enter Data ";cin >> data[a][b];} } clrscr(); for(a=0;a<=1;a++){for(b=0;b<=2;b++)cout << setw(5) << data[a][b];cout << endl ;} getch();} .43Program Calculates the sum of rows and columns of 2-dimension array. # include <iostream.h># include <conio.h># include <iomanip.h>void main(void){ int data[5][5];int a,b;int tr, total;int tc;clrscr();for(a=0;a<=4;a++){ for(b=0;b<=4;b++){cout << "Enter Data ";cin >> data[a][b];} } clrscr();//display and addtotal = 0;for(a=0;a<=4;a++){tr = 0;for(b=0;b<=4;b++){cout << setw(5) << data[a][b];tr = tr + data[a][b];} cout << setw(5) << tr;cout << endl ;total = total + tr;} for(a=0;a<=4;a++){tc = 0;for(b=0;b<=4;b++)tc = tc + data[b][a];cout << setw(5) << tc;} cout << setw(5) << total ;getch();} .44Arrays As Class Member Data# include <iostream.h># include <conio.h># include <iomanip.h>class
  • 23. shopping_mall{private:int shops[50];public:void assign(int income,int shop){ shops[shop] = income;} void display(int shop){cout << endl << "Income of a Shop " << shop << " is " << shops[shop] ;} } ;void main(void){ shopping_mall plaza1; shopping_mall plaza2;int a;clrscr();for( a=0;a<=49;a++)plaza1.assign(-1,a); for( a=0;a<=50;a++)plaza1.assign(-1,a);plaza1.assign(500,25); plaza1.assign(5000,15);plaza2.assign(2000,10);plaza2.display(10); plaza1.display(15);getch();} Array of Objects# include <conio.h># include <iostream.h># include <iomanip.h>class biodata{private: int rno;float fee; public: biodata(void){ rno = 0;fee = 0.0;} void assign(int r, float f){ rno = r; fee = f;} void input(void){ cout << endl << "Enter RNO : "; cin >> rno;cout << "Enter Fee : "; cin >> fee;} void display(void){cout << endl << "Roll No# " << setw(5) << rno << " Fee : " << fee;} } ;.45void main(void){biodata s1[20];int a; s1[0].assign(10,500);clrscr();for(a=1;a<=19;a++){s1[a].input();} clrscr(); for(a=0;a<=19;a++)s1[a].display();} Operator Overloading. Operator is a Sequence of symbols that define a certain operation on the data.Introduction What is Operator Overloadingˆ It is one of a most powerful feature of C++.ˆ Operator overloading is the straightforward and natural way to extend the C++.ˆ Normally the C++ operators can only be used with built in data types; however it is possible to enable the C++operators to work with user defined data type (class objects) by a process called an operator overloading.ˆ Operator overloading is most appropriate for mathematical classes.ˆ Operator overloading is not automatic, however; the programmer must write operator-overloading functions to perform the desired operations.ˆ Operator overloading function is like the normal function except that the function name is a keyword followed bythe symbol for the operator being overload.Advantages ˆOperator overloading contributes to C++ extensibility, one of the languageˆs most appealing attributes.ˆ Correct use of operator overloading makes a program clearer than accomplishing the same operations withexplicit function calls.Disadvantage ˆInconsistent use of operator overloading make a program cryptic and difficult to read.Limitation of Operator Overloadingˆ Operator overloading cannot change the precedence of an operator.ˆ Overloading cannot change the associativity of an operator.ˆ It is not possible to change the ˆarityˆ of an operator (i.e., the number of operands an operators takes). Overloadedunary operators remain as unary operators, overloaded binary operators remain as binary operators.ˆ Ternary operator ( ? : ) cannot be overloaded.ˆ It is not possible to create new operators: only existing operators can be overload.ˆ Operator overloading works with objects of user-defined types or a mixture of an object of a user-defined typeand an object of a built in type..46Overloading Unary Operators.Program Prefix (But doesnˆt allow assignment i.e., a = ++b)# include <iostream.h># include <conio.h>class myclass{private: int count;public: myclass(void){count = 0;} myclass(int c){count = c;} void display(void){cout << endl << "Count is " << count;} void operator ++ () // Increment Prefix{count++;} } ;void main(void) { myclass o1;myclass o2(5);clrscr();++o1;o1.display(); // Display 1o2.display(); // Display 5++o2;++o2;o2.display(); // Display 7getch(); } Program Prefix (Allows assignment i.e., a = ++b)# include <iostream.h># include <conio.h>class myclass{ private: int count;public: myclass(void){count = 0;} myclass(int c){count = c;} void display(void){cout << endl << "Count is " << count;} myclass operator ++ () // Increment Prefix with assignment ability{ count++;myclass temp;temp.count = count;return temp;} } ;.47void main(void){myclass o1;myclass o2;clrscr();++o1;o2 = ++o1;o1.display(); // Display 2o2.display(); // Display 2getch();} Program Overloading of unary operator (prefix/postfix) with assignments# include <iostream.h># include <conio.h>class myclass{private: int count;public: myclass(void){count = 0;} myclass(int c){count = c;} void display(void){cout << endl << "Count is " << count;} myclass operator ++ () // Increment Prefix with assignment ability{count++;myclass temp;temp.count = count;return temp;} myclass operator ++ (int) // Increment PostFix with assignment ability{myclass temp(count);count++;return temp;} } ;void main(void){myclass o1;myclass o2(10); myclass o3;myclass o4;++o1; // 1o3 = ++o1; // o3 = 2, o1 = 2o2++; // 11o4 = o2+ +; // o4 = 11, o2 = 12clrscr();o1.display(); // Display 2o2.display(); // Display 12o3.display(); // Display 2o4.display(); // Display 11getch();} .48 Overloading Binary OperatorsProgram: Overloading + operator# include <iostream.h># include <conio.h>class totalwork{private:int months;int days; public:totalwork(){months = 0;days = 0;} totalwork(int m, int d){months = m;days = d;} totalwork operator + (totalwork t){totalwork temp;temp.months = months +
  • 24. t.months;temp.days = days + t.days;if (temp.days > 30){temp.months++;temp.days = temp.days - 30;} return temp;} void display(void){cout << endl << endl << "Months : " << months;cout << endl << "Days : " << days;} } ;void main(void){ totalwork e1(5,10);totalwork e2(3,25);totalwork e3;clrscr();e1.display(); e2.display();e3 = e2 + e1;e3.display();getch(); } ################################################################################ ###############################################################################4 ###È###Î###Ï###Z ##b ##c ##ˆ ##ˆ ##ˆ ##æ ##ê ##ë ##ˆ###¥###
  • 25. ###
  • 30. ?ý##hû###5#ˆCJ #OJ##QJ###ˆ^J##aJ###&#h
  • 34. #h
  • 35. ?ý##hû###.####+###4###[###È###Ï###@ ##Z ##c ##ˆ ##ˆ ##æ ##ë ### ##V ##Â ##1###ˆ###
  • 36. ##|
  • 37. ##ó
  • 38. ##T##Ç ##5###ˆ###÷###b###ú############õ############ì############ì############ç######### ###ì############ì############ç############ì############ç############ì########### #ç############ì############ì############ì############ì############ì############ì ############ì############ì############ì############ì############ì############ì## ##########ì############ì################################gdˆBÜ# ##7$#8$#H$#gdû#######gdÓNk#####gdÓNk###b###Ò###>###} ###ˆ###Ð#######/###R###g###| ###ô#######P###s###ˆ###Î###õ###6###l###ˆ###ˆ###°###Ò###ó###########/###N###ö#### ########ö############ö############ö############ö############ö############ö###### ######ö############ö############ñ############ö############ö############ö######## ####ö############ö############ö############ö############ö############ö########## ##ñ############ö############ö############ö############ö############ö############ ö############ö############ö##################gd#KJ# ##7$#8$#H$#gdû#####N###u###¶###)###ˆ###Á###/###ˆ###û###f###s###u###ç######Ó###û ###j###ˆ###¥###Õ###í###############>###i###k###p###r###ú############ñ########### #ñ############ñ############ñ############ñ############ñ############ñ############ñ ############ñ############ñ############ñ############ñ############ñ############ñ## ##########ñ############ñ############ú############ñ############ñ############ñ#### ########ñ############ñ############ñ############ñ############ñ############ñ###### ######ñ############## ##7$#8$#H$#gdû#######gd#KJ#######s###u###w###| ###û###ý###ˆ###¥###Õ###########i###k###p###r###·###¹###¾###À### #######*###3###4###ˆ###ˆ###########C###E###)###I###d###ˆ###ˆ###ˆ###¤###¥###ç#### ##ïÞïÊïÞïÃïÊï¯ïˆï¯ïˆï¯ïÈÊïÞïÞïÞï¯ï¯ïˆÃˆït############################&#h
  • 44. #h
  • 48. ?ý##hû###CJ##OJ##QJ##^J##aJ##(r###ˆ###·###¹###¾###À###á### #######*###3###ˆ#######ˆ###¥###Ü###########/###`###ˆ###õ#######C###¬#######)###I ###d###ö############ö############ö############ö############ö############ö####### #####ö############ö############ñ############ñ############ö############ö######### ###ö############ö############ö############ö############ö############ö########### #ö############ö############ö############ö############ö############ö############ö ############ö############ö############ö##################gd#KJ# ##7$#8$#H$#gdû#####d###ˆ###ˆ###¥###ç#### ##0 ##@ ##R ##X ##ˆ ##ˆ ##¥ ##Ô ##ä ##ø ##û ###!###!###!##<!##L!##Y!##d!##ˆ!##ˆ!##¡!##Â!##È! ##ö############ö############ñ############ö############ö############ö############ ö############ö############ö############ö############ö############ö############ö# ###########ö############ö############ö############ö############ö############ö### #########ö############ö############ö############ö############ö############ö##### #######ö############ö############ö##################gd#KJ# ##7$#8$#H$#gdû#####È! ##Ô!##Ü!##è! ###"###"##'"##1"##="##e"##p"##w"##|"##ˆ"##ˆ"##¨"##À"##Ô"##á"##ü"######ˆ### $##ˆ$##ÿ$###%###%##M%##d %##ö############ö############ö############ö############ö############ö########### #ö############ö############ö############ö############ö############ö############ö ############ö############ö############ö############ö############ö############ö## ##########ö############ö############ö############ö############ö############ö#### ########ö############ö############ö##########################7$#8$#H$#gdû###### ##|"##ˆ"##ˆ"##ˆ"##ˆ"##¨"##ª"##À"##Â"##Ô"##Ö"##á"##ã"##ü"######.###3###t###y###O$ ##T$##÷$##ü$###%###%###%###%###%##&%##÷%##ý%###&###&## &##ïÞÍÞÍÞÍÞÍÞÍÞÍÞ¹Þ¹Þ¹Þ¹Þ¹Þ¹Þ«ˆˆÞ} fÞW##h
  • 59. &.# ##7$#8$#H$#gdû##### &##*&##+&##ˆ&##¥&##¶&##·&##2'##M'##q(##ˆ(##Û(##à(##))##0)##ˆ*##±*##Ï*##Ó*##ˆ+##ˆ +###,## ,## ,###,##ˆ,##¤,##¥,##¦,##ˆ-##¸-##ÿ-###.## .###.##X.##Z.##ˆ.##ˆ.##ˆ.## ˆ.##üè×è×É×è×è×è×è×è×è×è׸«×§è׈׈wˆ×h×è×è######h
  • 63. #h
  • 67. &.#(a'##{'##ˆ'##¡'##Ì'##Õ'##×'##)(##1(##N(##(##q(##å(##))## ˆ)##ÿ)##r*##ˆ*##±*##(+##ˆ+###,###,##!,##6,##L,##j,## ˆ,##ö############ö############ö############ö############ö############ö########## ##ö############ö############ö############ö############ö############ö############ ö############ö############ö############ö############ö############ö############ö# ###########ö############ö############ñ############ö############ö############ö### #########ö############ö###################################gd4Rˆ# ##7$#8$#H$#gdû#####ˆ,##¥,##í,##÷,##<-##S-##g-##w-##y-##ˆ-##¸-##Ö-##ä- ###.##N.##Z.## ¢.##¹.##Í.##Ý.##ß.##í.###/##</##S/##]/##ˆ/##©/##Å/##ú############ñ############ñ# ###########ñ############ñ############ñ############ñ############ñ############ñ### #########ñ############ñ############ñ############ñ############ñ############ñ##### #######ñ############ñ############ñ############ñ############ñ############ñ####### #####ñ############ñ############ñ############ñ############ñ############ñ######### ###ñ############## ##7$#8$#H$#gdû#######gdu#Î###ˆ.##</##S/## ˆ/##ˆ/##¤/##©/##Ò/##ð/##ñ/##ò/##w2##ˆ2##³4##µ4##Ê4##Ë4##¸5##Õ5###7##)7##]7##m7## #8###8##E8##M8##]8##ˆ8##ˆ8##ˆ8##½9##¿9## :###:##ˆ:## ˆ:##_;##u;##¸;##Ï;##õ;###<##T<##a<##ª<##º<##
  • 71. #h
  • 74. ?ý##hû###CJ##OJ##QJ##^J##aJ##8Å/##Î/##Ð/##Ò/##ò/##=0##®0## 1##u1##ˆ1##¸1##Þ1##þ1###2##- 2##R2##w2##ˆ2###3###3##93##a3##ˆ3##¨3##µ3##)4##34##<4##C4##ö############ö####### #####ö############ö############ö############ö############ö############ö######### ###ö############ö############ö############ö############ö############ö########### #ö############ö############ñ############ö############ö############ö############ö ############ö############ö############ö############ö############ö############ö## ##########ö##################gdi8~# ##7$#8$#H$#gdû#####C4##n4##x4##ˆ4##ˆ4##µ4##Ë4##!5##ˆ5##¸5##Õ5##á5##ð5## 6## %6##16##A6##J6##`6##t6##ˆ6##ˆ6##ˆ6##ˆ6##ˆ6##§6##Æ6##å6###7##ö############ö###### ######ö############ö############ö############ñ############ö############ö######## ####ö############ñ############ö############ö############ö############ö########## ##ö############ö############ö############ö############ö############ö############ ö############ö############ö############ö############ö############ö############ö# ###########ö##################gdi8~# ##7$#8$#H$#gdû######7###7###7##)7##27##F7##]7##m7##o7##{7##ˆ7##- 7##¶7##¸7##Á7##Õ7##ì7###8###8###8## 8##*8##B8##R8##ˆ8##ˆ8##ˆ8##ý8##m9##ö############ö############ñ############ö##### #######ö############ö############ö############ö############ö############ö####### #####ö############ö############ö############ö############ö############ö######### ###ö############ö############ö############ö############ö############ö########### #ö############ö############ö############ö############ö############ö############# #####gdi8~# ##7$#8$#H$#gdû#####m9##¿9##È9##Ü9##ó9## :###:###:##':##1:##I:##Y:##i:##t:##} :##ˆ:##ô:##+;##4;##H;##_;##u;##ˆ;## ˆ;##ˆ;## ˆ;##µ;##Ï;##ß;##ö############ö############ö############ö############ö########### #ö############ö############ö############ö############ö############ö############ö ############ö############ö############ö############ö############ö############ö## ##########ö############ö############ö############ö############ö############ö#### ########ö############ö############ö############ö######################## ##7$#8$#H$#gdû#####ß;##ê;##ó;##õ;##T<##a<##i<##} <##ˆ<##ª<##º<##¼<##Ç<##Ô<##Þ<### =##
  • 78. ?ý##hû###CJ##OJ #QJ #^J #aJ#####hÎ_,##
  • 79. #h
  • 84. ?ý##hi8~#CJ##OJ##QJ##^J##aJ##%´>##¾>##Þ>##0?##¢?##³?##É?##Þ?##÷? ###@##l@##â@##ë@## A###A###A##ˆA##ˆA##ªA##ÁA##ÑA##ÓA##ÝA##çA##ýA## B###B##1B##3B##ö############ñ############ö############ö############ö############ ö############ö############ö############ñ############ö############ö############ö# ###########ö############ö############ö############ö############ö############ö### #########ö############ö############ö############ö############ö############ö##### #######ö############ö############ö############ö##################gdÎ_,# ##7$#8$#H$#gdû#####3B##ˆB##¥B##¹B##ÉB##ËB##åB##ïB###C##HC##tC## C##ÌC##ØC# #ôC###D##,D##HD##nD##yD##{D##ÛD##òD###E###E###E##&E##7E##AE##ö############ö##### #######ö############ö############ö############ö############ö############ö####### #####ö############ö############ö############ö############ö############ö######### ###ö############ö############ö############ö############ö############ö########### #ö############ö############ö############ö############ö############ö############ö ############ö######################## ##7$#8$#H$#gdû#####AE##[E##gE##sE##ˆE##ˆE##¦E##½E##ÌE##ãE##îE##úE##&F##7F##WF## F##ˆF##ˆF##ˆF## F###G##ˆG##ˆG##¡G##°G##²G##ÁG##ÃG##ÅG##ö############ö########### #ö############ö############ö############ö############ö############ö############ö ############ö############ö############ö############ö############ö############ö## ##########ö############ö############ö############ö############ö############ö#### ########ö############ö############ö############ö############ö############ö###### ######ö######################## ##7$#8$#H$#gdû#####ˆF## F##ˆG##¡G##úG## H##¡H##¤H##H##ôH###I##/I##½I##ÇI###J##DJ##|J##ˆJ##ÅJ##ÏJ##
  • 86. #h
  • 94. K##SK##ˆK##ˆK##áK##.L##EL##YL##mL##} L##ˆL##ˆL##ˆL##®L##¼L##ÏL##ùL##ûL## M##ˆM##ö############ö############ö############ö############ö############ö####### #####ö############ö############ö############ö############ö############ö######### ###ö############ö############ö############ö############ö############ö########### #ö############ö############ö############ö############ö############ö############ö ############ö############ñ############ö##################gdÝvm# ##7$#8$#H$#gdû#####ˆM##¶M##¾M##ÍM##×M##ÜM##æM##éM##øM##úM###N###N###N## N###N###N##ˆN##ëN###O###O###O##0O##;O##EO##O##iO##ˆO##ˆO##£O##ö############ö### #########ö############ö############ö############ö############ö############ö##### #######ö############ö############ö############ö############ö############ö####### #####ö############ö############ö############ö############ö############ö######### ###ö############ö############ö############ö############ö############ö########### #ö############ö######################## ##7$#8$#H$#gdû#####£O##°O##µO##ÂO##×O###P###P###P##ˆP##ýP##rQ##ÅQ##ÍQ##ÜQ##ÞQ##è Q##êQ##þQ###R## R##
  • 95. R###R###R###R###R##ˆR##¥R##¼R##ÐR##ö############ö############ö############ö##### #######ö############ö############ñ############ö############ö############ö####### #####ö############ö############ö############ö############ö############ö######### ###ö############ö############ö############ö############ö############ö########### #ö############ö############ö############ö############ö############ö############# #####gdÝvm# ##7$#8$#H$#gdû#####ÐR##àR##âR##íR##÷R###S###S##1S##FS##S##rS##ˆS##ˆS##- S##¿S##ÄS##ÔS##âS##VT##ˆT##- T##ÁT##ÑT##ÓT##ÞT##çT##ñT###U###U##ö############ö############ö############ö##### #######ö############ö############ö############ö############ö############ö####### #####ö############ö############ö############ö############ö############ö######### ###ö############ö############ö############ö############ö############ö########### #ö############ö############ö############ö############ö############ö############# ########### ##7$#8$#H$#gdû######U##>U##IU##fU##uU##ˆU##ˆU##¸U##ÌU##òU###V##,V##@V##fV##kV##ˆ V##ˆV##ˆV##¡V###W##5W##WW##`W##hW##pW##ãW##0X##¨X##åX##ö############ö########### #ö############ö############ö############ö############ö############ö############ö ############ö############ö############ö############ö############ö############ö## ##########ö############ö############ñ############ö############ö############ö#### ########ö############ö############ö############ö############ö############ö###### ######ö##################gdÝvm# ##7$#8$#H$#gdû#####ˆV##ˆV##ˆV##¡V##pW##tW##0X##3X##åX##éX##zY##} Y##ˆY##ÄY##ÔY##Ö Y##áY##Ñ[##Ú[##î[##þ[##1##@##N##h##ˆ##¤##Ë##ë###]###]##K]##T]##¾]##Î]## ^###^##D^##I^##q^##t^##ˆ ^##Ç^##Ï^###`###`##[`##g`##i`##q`##ˆ`##ˆ`##½`##Å`##é`##ñ`## a###a##8a##Aa##ua##ˆa## ¢a##ªa##ìa##ýa##&b##Nb##Ub##bb##®b##ºb##ùéùØÄØÄØÄصÄØÄØÄØÄØÄØÄØÄØÄØÄØÄØÄØÄØÄØÄص ÄØÄØÄØÄØÄØÄØÄØÄØÄØÄØùØÄØÄØÄØÄØÄ#####h