Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
22 views
Chapter 4, C++
Uploaded by
jangrasahab4556
AI-enhanced title
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Chapter 4 , c++ For Later
Download
Save
Save Chapter 4 , c++ For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
22 views
Chapter 4, C++
Uploaded by
jangrasahab4556
AI-enhanced title
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Chapter 4 , c++ For Later
Carousel Previous
Carousel Next
Save
Save Chapter 4 , c++ For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 25
Search
Fullscreen
4.1 Introduction ‘na poram mase up o cat single salemets the paver ana asset tert he fw of ‘Storaton lz called tne eon fw eset Sumi! ne he ciel ow is save re spe the preyam as show niga Pegancvasodnuce ied te tow leas! “Ther are Wee Npee of cite! ences. (AiConctions! Control Tranter or Decision conutatarigeenecnstoraseeee ena (0) 8 ie sataent 109 sac store © putcretua ss ane Seeas aanseeT oe (©oRepeting Snamerts : Papin suri ae and ped ven & Siew y i Wi ee, a Ph IIE get eens rego canner se tr toe te eT ewe, $0 in tatan, ne Her, nies Hare i not Sat Shek mi be sipped. Flow SSiettsanowrn #2Example 44 i sccarsing 10 80 Some examples othe statement are ven below, 1 ‘peed = = 100) ‘coupe is egal to 100", ‘There only one statement the if statement bck, there Tepito jock, free at ments < 35) t cout" Fares = fates « 1 be cndtn ew (ema ess han 9), ame ‘nov wearisome tM MS ge, namie 42 ‘Wa a ogame geo wo hen mabe Aria ie ies ace ren 5 oe boron cena tage ‘ty coment ap he So somes = oe ; sen ‘ota [== Sorgen reIs ES wenn cy cy er oie = | Seer. ewes: Se3 The if....else statement ‘The general for of thi statement ie eondon) t sttement- 1 ' 2 the given conto is tue tan statement is executed chore statement ‘xocutea. Flowchart ef bis stants shown fig. 45 ioe c tot s met t: eon wemeiese Dos penini eon be ne pn som tg EPs; . a ite suman ns 4 2 ge ne er (og mater» TF (a>) THEN. oad a HSE big = tere nd hd mabe, the re TF > bit) THEN big = as = ‘ ie ic 4 sara =o amber, 1)PROGRAM Made coin el man) t Soot shee tne ule oe mambo a> ir he ies We> he foe" number ei few: , Ir he amber iou 4 care orisiediconts ee cea amount = "cet pas 1. Panoot, 125 en za, Homes itapucase smd fo mae an 6 11 0% 8 sowed Devacp a programa compute pce 2 Aoi 1 tga be 2 Cope dic 82 — dae 4 ie <0 then pat ‘rot are net rea ate JBRS)I24 tm 0-25 + Ouput root 1, root. ‘S. stop seme a 2, Frio alos oa inate aguas a+b ‘Answers / Hints to Self Check 1 Ari 1 gabe pacha gant, 24.09 > 10 ten dsm = 21 tera daa = 0 4 Gonpte Cat = 7 * 1S (18 diet, 4 Ongar CatProgra ied ae | rem hero moie; cout" Enter the values of coeff."<<"0"; — see es ; root Segtiuc tates oad a mmvors using nosed # statement tet nsec sh vara nto. 611 moana rent ‘sect i ma foot abhi: Ce ee number": Toe ee Hew ;: ements eh ben: nctager miter che po aw FS re mbes eget mater 76 4. Nested if Statements ‘ref atment may conan neo rere steers. a suchas, bey ae so. Ar erareo of ose erent shown boom (en= a, pipers a = = = a ae ; on 8 senenroemenes gi tee coll eo eg am Sd na ah a nognnr eee Semen oe psceets iin a = ae ne : I; Pace | ss nes — ’ Vat nna as : Welte HRA rune 413, : eo a = SS Sree aman ng ta mie ae eer i Fie = } The else if Indder ne student, given his marks. ite a program to epay the grade ofthe student oven (esFovehar ot his exam ‘PROGRAM OS shown nig. 414 ms int arts; le Utmaho50 grace’ he Gtearts-9) grade ra 5000-03 rk | i sat |e cnn mreaor02000 |) a rtoreaerne | ser Sa | ee area lee l ‘The switch Statement Take an Weitere BR. ser check2 toa prog octal he nco {ar according town cea i $0001 wo 60000 s 2,001 12, ‘The snitch statement et the value of avon exprossion aga! @ et of ese 7? z se ‘when amatchis ound, astatorentor statements associat wit he “The gonotel form of hs statements wn assh Cexpreson) 0 a 2 ees is sion" tome ee eae ety eed i ae ca carps te Second iia treat ttm © pcx conan pase = : Tr seettoncan be ange orate Teepe oa persone terme Coe tn, {steno ilo secede beak aor at oa a ae ws, oc cts parte ese and canes srl oan ser : 1 grade represent A, Passe
,
srccendl: rectangle seurSetour color irosenotes Sectchoee) "ase gutceEntr the sides of the rectal = cins>sde=sdeds iemcuide ide treat em oy Bter the ras + cute coutc<"Bnter the sd of the triangle = Sinssap>bsoer fmlavbsenae mremmagtinab ee ime game aaa, ieee, a4 7 The goto Statement TRS stoner ana contt upon Regnea Genet senat PH HN eg se bt label ean val vale name Ont oe statement "Sool statements pertaed by abn te flowing rare EY by ‘Acolon sapratas the label and he labeled sateen Example 414 i “Repetitive Structures (loops) | peop mats opeating sme portion 1m other a spected nb of nes, eee pcnganistoaMnarapatve operation (eopirg) Is ocheved ee Satan awhile ora donwhlle ora for statement fate carota ot he, ws ‘ett Scents commend tal ban ona sea Repent ences oon _— ‘Seeman mah 8 aS yey Pont Ineaion : In 0 epetve te tae ort he po fey Example 435 Sacre, come vans ae ase whieh oa prone fe conic’ curing ateruton ot Tapetve one the Ss oot ramber Src. ieee Aeon (0 Loop: Ase of staterents ave oxocted using ‘Sted many te wile thse sttorert ‘Seperence rogram (NEL Point: Thre ms bean ext pnt come ‘uctiop so rat oop ces no Became int 2 inc hen GOTO te 1 ae Ral san 2 up Resa C (100) on‘3 Powcharot tis example shown ng, 426 PROGRAM {naman denn ten | Geena” mien |) ies tf incade itrean> td late “min La | i ro 7 : 4.11 The do Statement ~o 3 “rate
‘nce
old main ' Boat sumsinambermen; Lorattconios) ' ionumber: ; a Enter ttl number be averaged :$ Enter 5 mumters 0 20 70) , a) ec Fara = "fet i teins) ofa ‘eure = ) nt et i ter & mamber : 6 Factorial = 720 om3. Fowehen : Paoeaet arbi ominne ty 48 FE re or Lane — ‘capabilties that are not found in other loop constructs. saasitons ese Site 7 for (i=; #<10; i++) , 1 sty evntim tcaes tt ne of ho i itiazod 0 Iinaroments 2 a i remains less than 10. The: op tos ho lop ar repeated a8 1000 08 outce"Ener the ae of "5 or tment ert oop index Intalized outside the 1o0p. ome He de eto og #010 eotce"Entr the number of ems ‘a0; oes ee, for (iel0s in) m= { £ mae statements; Jortahinmies) ! } i “orp wih ntizaon of oop index and increment outside the for loop is erm txt; foro fect 2 ist rany, ae nae heen ainingy ! ; statements; coutce"Sum of series: “ccsum; sem um we 1p wa i ; e 7P Mh tteaton ot op index, loop condo & increment outside the for statemen le tis Ran: Enter the value of 05 rer the numberof ters : 4 ‘Sum of the series : as21095.454 The comma Operator Wie now: fn 40; bss canbe wren as b Jo Ue ot tet: ony t ; {se be raat sein. MERA AON May ve a, Example 419 > for Wott it0 tony 1 1 1s so posuble 12. use expression Inthe Assignment salman ae [cxsement sectena: For exrnle oO a eoe a aube :* Jor was Bit: 4305222) 4.15 The break statement Sometimes © progiammer may wish to ext he loop even whan the ancton s rue. This is possive wih the bret satomont Weave ea ee Steven io en tom a switch Beck Ths may be used in any pe eee ‘Sowing 436 ‘cutee Prime mumber” ’ Prime number Veron bres gram Bw moment mL ou I Be 60 he message “Not ape numba” ed ana the cia breaks ut tha while Wp. In hese ope, break aes Te matte the ane oop ony (14) cs)Example 421 S| sae sied rie Le i pros Beoran fron pr oor brs ang, 0 clude
include
sold maint) ‘ int romps conteeendlcc"*"ccendl Jortrow=ljrowexSirowes) t coutce"" {foriplas=Ipilusc-rowplust+) coutccendl;Pinctadeciotram hs or a include conia te a) Merges ho een na ret tee a et as pg se void main nr Pn a proces to prosk t ond {) tunaon U5 Int wine st es nt Hutto btn ster reenter ‘outce"Enter the mamterof pra ines ‘lnm: camber is pie oF Sorirowat iro t ar wine cade tren (tions) Mor pecig Sect Seniot pines snes aclu spree SelehicroJoe) No et hap comes ‘iat, i orhoosttoaih) Horie ball utente a mamber cuts"; ane he ne yin m2) , to) st coutce'Not «prime number"; , sche sue outecprime number”: (ea a 2 hat ‘na eaam,# he gv number fe vee by any number tom ‘unos he rogram delays a massage tat he rumba snot pine and ex owam atti eaured by ex) clon, fro)sore cont sn ovale - a HER Sayan we tls satemenn est ena Bi none ofthe . se Maa Second sete statements ar on ae omar ses ; rere Oe an toxin cote? * eter tetas stm : sib the output ofthe ae coat ccm oe oo ae Bone he above Gir aas = itch sntement can be used 8 incase of ogical operators us * Pare, 8. Remaatal "¥e5 0 oops, namo, ‘orden corte and our ne output of the following code? + bandon prey onctonna ga ef seaarnene cana aot te wit ns FS In counter, conttlled loop, we know the number of times the of the lop eg ™ freee Eamteoe eee ea 10 white toop, conciton |S evaluated frst, Theretore, ofthe Hoop maya 1 wll (meny Sneath et Band kw a irpation is evaluated atthe end Ther con ints steno 5 De beak statment causes ext A tamaltnesensioe 8. om th imermos oop containing 6 fen apa D. atthe are Wt et ote ong cade» wi ia tains ‘ere con a aw 8s ar BO ta ae —
You might also like
Introduction To Programming For Engineers Using Python
PDF
No ratings yet
Introduction To Programming For Engineers Using Python
358 pages
PIC chapter 2-Control Structure
PDF
No ratings yet
PIC chapter 2-Control Structure
30 pages
Loop Questions
PDF
No ratings yet
Loop Questions
18 pages
Bhavya 4th February 2023 Notes
PDF
No ratings yet
Bhavya 4th February 2023 Notes
16 pages
Programming Keys
PDF
No ratings yet
Programming Keys
20 pages
PPS Unit 3
PDF
No ratings yet
PPS Unit 3
27 pages
BCP AB
PDF
No ratings yet
BCP AB
65 pages
C Programming Language
PDF
No ratings yet
C Programming Language
55 pages
Data Structures Unit 1 - SVS
PDF
No ratings yet
Data Structures Unit 1 - SVS
21 pages
Notesof C Language by Abhay Kumar Awasthi Till Recursion
PDF
No ratings yet
Notesof C Language by Abhay Kumar Awasthi Till Recursion
27 pages
Cs Notes
PDF
No ratings yet
Cs Notes
28 pages
c programming
PDF
No ratings yet
c programming
26 pages
fpl set A
PDF
No ratings yet
fpl set A
13 pages
C
PDF
No ratings yet
C
25 pages
C Language Notes-2
PDF
No ratings yet
C Language Notes-2
40 pages
Basic Handnote of CSE-101 Course
PDF
No ratings yet
Basic Handnote of CSE-101 Course
43 pages
Lab 2
PDF
No ratings yet
Lab 2
21 pages
4 PythonLoops
PDF
No ratings yet
4 PythonLoops
17 pages
Computer Programs Code
PDF
No ratings yet
Computer Programs Code
70 pages
Python question bank
PDF
No ratings yet
Python question bank
13 pages
C Programming
PDF
No ratings yet
C Programming
7 pages
C7 Iteration
PDF
No ratings yet
C7 Iteration
10 pages
C Language Notes
PDF
No ratings yet
C Language Notes
97 pages
python model practical..(set 4)
PDF
No ratings yet
python model practical..(set 4)
65 pages
OOPS Practical Mine PDF
PDF
No ratings yet
OOPS Practical Mine PDF
67 pages
Java Notes
PDF
No ratings yet
Java Notes
37 pages
Lab Functions
PDF
No ratings yet
Lab Functions
7 pages
18CS752-Python 4
PDF
No ratings yet
18CS752-Python 4
16 pages
Introduction to Programming for Engineers Using Python(1)
PDF
No ratings yet
Introduction to Programming for Engineers Using Python(1)
358 pages
C Notes
PDF
No ratings yet
C Notes
44 pages
Computer Science Notes
PDF
No ratings yet
Computer Science Notes
36 pages
C Language 1
PDF
No ratings yet
C Language 1
44 pages
R Programming Notes
PDF
No ratings yet
R Programming Notes
24 pages
Ch04 Iteration
PDF
No ratings yet
Ch04 Iteration
12 pages
chapter_8
PDF
No ratings yet
chapter_8
24 pages
MCS-011 Problem Solving and Programming
PDF
No ratings yet
MCS-011 Problem Solving and Programming
13 pages
Haltermanpython PDF
PDF
No ratings yet
Haltermanpython PDF
283 pages
Flow of Control
PDF
No ratings yet
Flow of Control
42 pages
Computer.ch8
PDF
No ratings yet
Computer.ch8
16 pages
Computer Past Papers
PDF
No ratings yet
Computer Past Papers
14 pages
C Programming Notes Part 2
PDF
No ratings yet
C Programming Notes Part 2
24 pages
Lab Report 3-4
PDF
No ratings yet
Lab Report 3-4
47 pages
New Doc 02-22-2024 23.56
PDF
No ratings yet
New Doc 02-22-2024 23.56
27 pages
0445 Fundamentals of C Programming
PDF
No ratings yet
0445 Fundamentals of C Programming
6 pages
C Language Notes-1
PDF
No ratings yet
C Language Notes-1
41 pages
Programming Class 3 Note
PDF
No ratings yet
Programming Class 3 Note
90 pages
AKU PPS Pyq 2019
PDF
No ratings yet
AKU PPS Pyq 2019
11 pages
CP ASSIGNMENT 1..
PDF
No ratings yet
CP ASSIGNMENT 1..
15 pages
C++ Part3
PDF
No ratings yet
C++ Part3
13 pages
ICT Chapter 5
PDF
No ratings yet
ICT Chapter 5
28 pages
Unit 3
PDF
No ratings yet
Unit 3
19 pages
Pps Lab File
PDF
No ratings yet
Pps Lab File
32 pages
Fundamentals of Programming C++
PDF
100% (1)
Fundamentals of Programming C++
647 pages
Best C++
PDF
No ratings yet
Best C++
647 pages
Raushan Kumar - 22scse2120040 (DAA)
PDF
No ratings yet
Raushan Kumar - 22scse2120040 (DAA)
18 pages
Progcpp PDF
PDF
No ratings yet
Progcpp PDF
638 pages