SlideShare a Scribd company logo
Introduction ttoo PPrrooggrraammmmiinngg 
LLeeccttuurree 3366
#iinncclluuddee <<iioossttrreeaamm..hh>> 
##iinncclluuddee <<ffssttrreeaamm..hh>>
iioommaanniipp..hh
 cciinn..eeooff (( )) ;; 
 cciinn..ffaaiill (( )) ;; 
 cciinn..bbaadd (( )) ;; 
 cciinn..ggoooodd (( )) ;; 
 cciinn..ccllrreeaarr (( )) ;;
MMaanniippuullaattoorrss
SSttrreeaamm 
MMaanniippuullaattoorrss
float PPII == 33..11441155992266 ;;
eennddll
ccoouutt <<<< eennddll ;;
ccoouutt <<<< fflluusshh ;;
MMaanniippuullaattoorr 
WWiitthh AArrgguummeennttss
IInnlliinnee 
MMaanniippuullaattoorr
ccoouutt..fflluusshh (( )) ;;
NNuummbbeerr SSyysstteemm 
 BBiinnaarryy 
 DDeecciimmaall 
 OOccttaall 
 HHeexxaaddeecciimmaall
EExxaammppllee 
iinntt ii == 1100 ;; 
ccoouutt <<<< ii ;;
1 100
EExxaammppllee 
##iinncclluuddee <<iioossttrreeaamm..hh>> 
##iinncclluuddee <<iioommaanniipp..hh>> 
mmaaiinn (( )) 
{{ 
iinntt ii == 1100 ;; OOuuttppuutt 
ccoouutt <<<< oocctt <<<< ii <<<< eennddll ;; 1122 
ccoouutt <<<< hheexx <<<< ii<<<< eennddll ;; AA 
ccoouutt <<<< ddeecc <<<< ii <<<< eennddll ;; 1100 
}}
WWhhiittee 
SSppaaccee
WWSS 
MMaanniippuullaattoorr
sseettww
##iinncclluuddee <<iioossttrreeaamm..hh>> 
##iinncclluuddee <<iioommaanniipp..hh>> 
mmaaiinn (( )) 
{{ 
iinntt ii == 55 ;; 
ccoouutt <<<< ““TThhee vvaalluuee ooff ii iiss == ”” ;; 
ccoouutt <<<< sseettww (( 44 )) <<<< ii <<<< eennddll ;; 
}} 
EExxaammppllee
sseettffiillll
cout << sseettffiillll (( ‘‘**’’ )) ;; 
A Character
EExxaammppllee 
##iinncclluuddee<<iioossttrreeaamm..hh>> 
##iinncclluuddee<<iioommaanniipp..hh>> 
MMaaiinn (( )) 
{{ 
iinntt ii == 44000000 ;; 
ccoouutt <<<< sseettffiillll (( ‘‘**’’ )) <<<< sseettww (( 1100 )) <<<< ii <<<< eennddll ;; 
}}
SSeett PPrreecciissiioonn 
MMaanniippuullaattoorr
EExxaammppllee 
##iinncclluuddee<<iioossttrreeaamm..hh>> 
##iinncclluuddee<<iioommaanniipp..hh>> 
mmaaiinn (( )) 
{{ 
ffllooaatt nnuummbbeerr == 66..6677007766663322 ;; 
ccoouutt <<<< sseettpprreecciissiioonn (( 22 )) <<<< nnuummbbeerr <<<< eennddll ;; 
}}
##ddeeffiinnee PPII 33..11441155992266 
mmaaiinn (( )) 
{{ 
ccoouutt <<<< PPII <<<< eennddll ;; 
ccoouutt <<<< sseettpprreecciissiioonn (( 22 )) <<<< PPII <<<< eennddll ;; 
}} 
EExxaammppllee
sseettbbaassee
##iinncclluuddee <<iioossttrreeaamm..hh>> 
##iinncclluuddee <<iioommaanniipp..hh>> 
mmaaiinn (( )) 
{{ 
iinntt xx == 1100 ;; 
ccoouutt <<<< sseettbbaassee (( 88 )) <<<< xx <<<<eennddll ;; 
ccoouutt <<<< sseettbbaassee (( 1166 )) <<<< xx <<<<eennddll ;; 
ccoouutt <<<< sseettbbaassee (( 1100 )) <<<< xx <<<<eennddll ;; 
ccoouutt <<<< sseettbbaassee (( 00 )) <<<< xx <<<<eennddll ;; 
}} 
EExxaammppllee 
Same as setbase (10)
Input OOuuttppuutt ssttaattee ffllaaggss 
IIOOSS FFllaaggss
wwiiddtthh (( )) ;;
cciinn..wwiiddtthh (( 77 )) ;; 
ccoouutt..wwiiddtthh (( 1100 )) ;;
cout.pprreecciissiioonn (( 22 ))
##iinncclluuddee <<iioossttrreeaamm..hh>> 
##iinncclluuddee <<iioommaanniipp..hh>> 
mmaaiinn (( )) 
{{ 
iinntt ii == 1100 ,, jj == 2200 ;; 
ccoouutt <<<< sseettww (( 77 )) <<<< ii <<<<eennddll ;; 
ccoouutt <<<< jj ;; 
}} 
EExxaammppllee
Formatting Manipulation 
 iiooss :::: aaddjjuussttffiieelldd 
 iiooss :::: lleefftt 
 iiooss :::: rriigghhtt 
 iiooss :::: lleefftt || iiooss :::: rriigghhtt ,, iiooss :::: aaddjjuussttffiieelldd
cout.setf ( ios :::: lleefftt ,, iiooss :::: 
aaddjjuussttffiieelldd )) ;; 
SSeett FFllaagg
cout.ffiillll (( ‘‘**’’ )) ;;
cout.ffiillll (( ''00'' )) ;;
Formatting MMaanniippuullaattiioonn 
ccoouutt..ffiillll (( ''00'' )) ;; 
ccoouutt <<<< sseettww (( 1100 )) <<<< nnuummbbeerr <<<< eennddll ;;
cout.setf (( iiooss :::: hheexx )) ;;
77ffff 
0111 1111 1111
sshhoowwbbaassee
sshhoowwbbaassee 
ccoouutt..sseettff (( iiooss :::: sshhoowwbbaassee )) ;;
sshhoowwbbaassee 
cout.sseettff (( iiooss :::: sshhoowwbbaassee )) ;; 
ccoouutt..sseettff (( iiooss::::ddeecc ,, iiooss :::: bbaasseeffiieelldd )) ;; 
ccoouutt <<<< xx <<<< ''nn'' ;; //// OOuuttppuuttss 7777 
ccoouutt..sseettff (( iiooss :::: oocctt ,, iiooss :::: bbaasseeffiieelldd )) ;; 
ccoouutt <<<< xx <<<< ''nn'' ;; //// OOuuttppuuttss 007777 
ccoouutt..sseettff (( iiooss :::: hheexx ,, iiooss :::: bbaasseeffiieelldd )) ;; 
ccoouutt <<<< xx <<<< ''nn'' ;; //// OOuuttppuuttss 00xx7777
iiooss :::: 
sscciieennttiiffiicc
cout.setf ( ios :::: sscciieennttiiffiicc )) ;;
Scientific NNoottaattiioonn 
++//-- 
11..22333344ee++0099
FFiixxeedd PPooiinntt 
NNoottaattiioonn
iiooss :::: ffiixxeedd
iiooss :::: 
uuppppeerrccaassee
What wwee lleeaarrnntt ssoo ffaarr.... 
 IInnppuutt OOuuttppuutt SSttrreeaamm 
 AAnndd tthheeiirr 
MMaanniippuullaattiioonnss iinn CC++++

More Related Content

PPT
CS201- Introduction to Programming- Lecture 37
PPT
CS201- Introduction to Programming- Lecture 34
PPT
CS201- Introduction to Programming- Lecture 15
PPT
CS201- Introduction to Programming- Lecture 38
PPT
CS201- Introduction to Programming- Lecture 35
PPT
CS201- Introduction to Programming- Lecture 20
PPT
CS201- Introduction to Programming- Lecture 13
PPT
CS201- Introduction to Programming- Lecture 40
CS201- Introduction to Programming- Lecture 37
CS201- Introduction to Programming- Lecture 34
CS201- Introduction to Programming- Lecture 15
CS201- Introduction to Programming- Lecture 38
CS201- Introduction to Programming- Lecture 35
CS201- Introduction to Programming- Lecture 20
CS201- Introduction to Programming- Lecture 13
CS201- Introduction to Programming- Lecture 40

What's hot (19)

PPT
CS201- Introduction to Programming- Lecture 07
PPT
CS201- Introduction to Programming- Lecture 03
PPT
CS201- Introduction to Programming- Lecture 18
PPT
CS201- Introduction to Programming- Lecture 16
PPT
CS201- Introduction to Programming- Lecture 33
PPT
CS201- Introduction to Programming- Lecture 30
PPT
CS201- Introduction to Programming- Lecture 12
PPT
Perangkat keras komputer
PPT
Perangkat Keras Hardware
PPT
pengenalan perangkat keras komputer
PPT
Hardware
PPT
CS201- Introduction to Programming- Lecture 11
PPT
CS201- Introduction to Programming- Lecture 44
PPT
CS201- Introduction to Programming- Lecture 19
PPT
Design of the South Doña Ana Dam
PPT
Ethernet Passive Optical Network
PPT
CS201- Introduction to Programming- Lecture 24
PPT
Ethernet Over CoAxial(EOC)
PPT
CS201- Introduction to Programming- Lecture 26
CS201- Introduction to Programming- Lecture 07
CS201- Introduction to Programming- Lecture 03
CS201- Introduction to Programming- Lecture 18
CS201- Introduction to Programming- Lecture 16
CS201- Introduction to Programming- Lecture 33
CS201- Introduction to Programming- Lecture 30
CS201- Introduction to Programming- Lecture 12
Perangkat keras komputer
Perangkat Keras Hardware
pengenalan perangkat keras komputer
Hardware
CS201- Introduction to Programming- Lecture 11
CS201- Introduction to Programming- Lecture 44
CS201- Introduction to Programming- Lecture 19
Design of the South Doña Ana Dam
Ethernet Passive Optical Network
CS201- Introduction to Programming- Lecture 24
Ethernet Over CoAxial(EOC)
CS201- Introduction to Programming- Lecture 26
Ad

Viewers also liked (20)

PPT
CS201- Introduction to Programming- Lecture 42
PPS
CS101- Introduction to Computing- Lecture 36
PPS
ENG101- English Comprehension- Lecture 26
PPT
CS201- Introduction to Programming- Lecture 17
PPS
CS101- Introduction to Computing- Lecture 45
PPT
CS201- Introduction to Programming- Lecture 21
PPT
MGT101 - Financial Accounting- Lecture 32
PPS
ENG101- English Comprehension- Lecture 38
PPT
MGT101 - Financial Accounting- Lecture 23
PPS
CS101- Introduction to Computing- Lecture 25
PPT
MGT101 - Financial Accounting- Lecture 35
PPT
CS201- Introduction to Programming- Lecture 41
PPS
CS101- Introduction to Computing- Lecture 28
PPTX
Making information easy for voters
PPTX
Designing for the Voter Experience: Learning from Voters
PPTX
Adjetivos
DOCX
Resumen el enfero imaginario
PDF
Global Citizenship Digest- 2010 Winter
DOCX
Thesis
CS201- Introduction to Programming- Lecture 42
CS101- Introduction to Computing- Lecture 36
ENG101- English Comprehension- Lecture 26
CS201- Introduction to Programming- Lecture 17
CS101- Introduction to Computing- Lecture 45
CS201- Introduction to Programming- Lecture 21
MGT101 - Financial Accounting- Lecture 32
ENG101- English Comprehension- Lecture 38
MGT101 - Financial Accounting- Lecture 23
CS101- Introduction to Computing- Lecture 25
MGT101 - Financial Accounting- Lecture 35
CS201- Introduction to Programming- Lecture 41
CS101- Introduction to Computing- Lecture 28
Making information easy for voters
Designing for the Voter Experience: Learning from Voters
Adjetivos
Resumen el enfero imaginario
Global Citizenship Digest- 2010 Winter
Thesis
Ad

Similar to CS201- Introduction to Programming- Lecture 36 (20)

PPT
CS201- Introduction to Programming- Lecture 25
PPT
CS201- Introduction to Programming- Lecture 22
PPT
CS201- Introduction to Programming- Lecture 10
PPT
CS201- Introduction to Programming- Lecture 23
PPT
Securing PHP Applications
PPT
CS201- Introduction to Programming- Lecture 14
PPT
Mba ebooks
PPT
CS201- Introduction to Programming- Lecture 08
PPT
Penetration testing: A proactive approach to secure computing - Eric Vanderbu...
PPT
CS201- Introduction to Programming- Lecture 09
PPT
Chapter 6 testbench
PPT
CS201- Introduction to Programming- Lecture 29
PPT
CS201- Introduction to Programming- Lecture 28
PPT
21 High-quality programming code construction part-ii
PPT
CS201- Introduction to Programming- Lecture 04
PPT
CS201- Introduction to Programming- Lecture 45
PPT
Solving linear equations (chapter 2)
PPT
Software engineering
PPT
Microsoft excel 2
PPT
Measures in informatics
CS201- Introduction to Programming- Lecture 25
CS201- Introduction to Programming- Lecture 22
CS201- Introduction to Programming- Lecture 10
CS201- Introduction to Programming- Lecture 23
Securing PHP Applications
CS201- Introduction to Programming- Lecture 14
Mba ebooks
CS201- Introduction to Programming- Lecture 08
Penetration testing: A proactive approach to secure computing - Eric Vanderbu...
CS201- Introduction to Programming- Lecture 09
Chapter 6 testbench
CS201- Introduction to Programming- Lecture 29
CS201- Introduction to Programming- Lecture 28
21 High-quality programming code construction part-ii
CS201- Introduction to Programming- Lecture 04
CS201- Introduction to Programming- Lecture 45
Solving linear equations (chapter 2)
Software engineering
Microsoft excel 2
Measures in informatics

CS201- Introduction to Programming- Lecture 36