[go: up one dir, main page]

0% found this document useful (0 votes)
45 views13 pages

Bhavya 28th January 2023 Notes

Uploaded by

Sisir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
45 views13 pages

Bhavya 28th January 2023 Notes

Uploaded by

Sisir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 13
LV \\\\ classmate. if @>b) & CA>C) » byint a else 4. (b> a) & Cb>c) 5 print b lelse joint c 28/01/2023 | Sa AM) shh ge Language in which we ane giving i instruchons to Oux computer: Also note that every programming wr ave Its Own Compr ler /ircterp rete Ex4 C++, C, Java, Python wv programming Ramuage Compilation process. - We wild be writing the code in the fugh ___ Devel Language bs Computer wont be cable to undenstand ib & we need a translator & hex compiler wi2t ack as a_trans lator: Comprlex wil? convert the high Level Janguage te- machine _undexstandable language: Machune ——— Sanguage means binary language pre Os & Is. Compile A Compilex £abes a progaan.as 'whdle— Ond genenats, inten mediate maachine cod es—Thi = trang lates the entire “ounce code in_a singe yun: (Lr ONY. intermedrat machine code: iG IDE The fuse form is inte yaked Develobmer Tool on which Wwe can. write the co te St f the environmenk ,.also—provides — ae Maou, feakuus & hence iE increases SU vuaiicu wiur vam chest, 7 | Ex Codeblocks 5 VS code, Sublime, Xcode == Writing oux fix £ progam _ Scope sh, nt mam () _ fot mand) £ 73 _ 1s_iS_similax to stat combonent we = have done fn the flowchart Compiler wile soxch for this & frem fuse the exe St tha -byogsam will Stant- 2 cout << “Namaste Bhanak” 5 This is used to byint on the console /soreen bude Ve Gives ON Cor th otis the use of undeclared ident fren - | This means that compiler _ does not Rnouw What is Couk: | Be fove we use. COUX 5 We! Reed tofnbort its code ok wecan use This £ r ( 3) Fle! ha. tea suing. (mplementahien gh Heincluds . cout <= us quot the-cods of fmblementahion ef, We use std is couk << “Hello”? 5 =r 4 This fs a Damesboce lamespace This ($ basically scone £ uk with be deth nett and._imb lementaben -— ent na, mesbacts-———— Stan, i —— bhence we wrote ¢ i cette _tmnplementab n cs Standond homes A namesbou, a ovaiicu wittt Valli classmate. Namespace iS oO veqion where thr scope eb identfiexs have been defined For artes scope_e}, cout IS defined In std Namespace _ But this 1's a Cumbexsome task ef writing Std $3 cout again again & hence we can _ desine [declase which namespace te-use ysing nameShace std i Novus we can 0 fun chonabity et firint si} ly ay couk << coukK<) “He mG) Tesrntnatuy L — For prnting ‘> Past of Syrnbols GAs U Standard oukp “Hi” 3 Heiis a vent (Siving) Written ins dowste Tnyeted. Commas 1 Couk << 25 7 Theme wil? be printing : Couk << "2" > YT 2 on tha scneer . ouk << 6275 Also note that << IS Rnown as insertion j LObex ator « — Stng®s frverked commas means chanackes + Double fryvented commas means String {Next Line HO go te the next Line we use Reywor 1 vvuaiicu wiul vam classmate, Date couki<< “Hee i Hi Hello couk << SHedlo’> kouk << “He” < He = Cour << “Hello” 5 J Helis 7 Note! Thens (6 one move way to add news Aine be new dine chanacten VR couk << He Nn” > CHE couk << “Hello” 5 J Helde- : . Log fcobby thine i's no difference blue endl & — me Taking Input From user Fox_pxinhng we use cout buk for taking — Input from ‘the Usex » Cin is used But for taking inpuk swe have ‘te store ikin x Imempxy & that memony Space is given a — name Int a 5 > Taking integer memory shace 4 f cin >ras hame a- qe bs To toke input & send it ts memory Sboce a Note “Hcamblels giving Input swe need GLE lenten Rey. a Comments (n C++ _— These Sines at \Gnoved. by compiler 2p — vuaiicu wiur vam tb _exeuiked We fave te add thin te make Une comment W This Q_comment Comments can be useh ts make notes. Alse there IS a Shortut te make a (ine commentis _| chrg + / Vaswable Vouables can _bede fined ax named rnemory § ocahon se that we can refer It fn fukure- Int a=75 ——> [7 | cout <| funehon, > O/b Tekuin tybe | int main 0) $ PZ By L Le Size Range Chan ~128-127 hort - 32168 - 32167 _—— int Ql 8 - 24.7 —— Long. T8l-- B-Q14.7 HF. 8- 92a..7 iene dong Long If loak 00 |-f [go |p |p |p | — 3-4 e+/-38 double I-7 e@ +/- 308 32 64 bit CPU + canbeWffenent for bre CPU Int daka tube a £ St memory - yobe 4x8=32 bis Boies Bbrts 8 ets Sets | (byte byte Lbyte | byte thie ase 2 I hence 23? ans bo one pee i itlest—ott chost data. Chax ch = a> S | byte _ 8 bts ¥ _l | byte aé Sea ep tessible as cack bis Lave either 6 ov Mc feted a begg — 2xXQ -- x2 =Q8 CB times _— _ = ovaiicu witth Gari classmate. Now qaushon comen that whether characte Q_IS Steved oy not. But a numbex is Stoved Instead 2 ale the Characters axe mapped te ASCIT vale fe a numeuc value £ thi humestic value is converted inte Os & Is & then Stored - QA 91- converted to os 2 IS Qnd-then_ Stored in memory boolean data tube Can have only Qvalus be _elther truror Ise ; aka type = a bool flag = trusa5 bood Flag = false! couk << Flag 5 > Gives o/p. 4. couk<< Flag 34 jo truz — 1 2 Simflax false + O AX The Sbace taken by boolean is [byte but _ it Is suffcienk to vebyvesent fe tn tf bit but shoe | byte 1's taken because moltst /minimum memory that can be Used. Is 1 byte. Thee is memory wastage alse. _ [aay te 4 is tb byte. floak & double data tybe There ons used for vebverenting dectmal AuUmbers + vuaimicu wiur vam | Float f= 1-25 a i double f = 1-25 a Tl But which one to use? Double fs more _ i et & Float takes up de Memory Skace - The one taking move _ 5 can_ye| (9g es Mutmber + 2 bo ase) Quap As we Rnous that’ as6 Characters cam onks ; be stored in chan but what ifwedo chan ch =2563 7 is 1S bastcalty the overf lous condvhon 2 2HnOy Comes 1-e Ovenflou Mn convenson From int £0 Chax changes vedue from "256? t@ “\ooo0”’ = Also we can say fort 8 bits wrd2% be cobred- wi Deuved Lean. Ex Ayrays» pointer ete. oto. tubes Primitive oka type ant ured fe malee ‘ ai) Vawwable naming convenhona &_undixscoves Names noust begin with fetter or underscore — Names are Care sengihve Names can not have sbaca £ ho Special charat then thon. Undinecore canbe sured sizeeh QO sea This vetwins The Sige of data. tup en bytes —~ ovaiicu wit vam sizeof Cint)s > 4 2 th bytes Sizeof Cchan) j 3 2 data. w Posihve numbers iin ar ='515 (fo) Sic) Tiel] B2bits chan ch =a’ 5 > Just convert the ASCIE Vodur te brassy & Then Ht wil be stra te thok Of Prtegen. i | - - SB bits It 's important tounote that first bit from Lebt wil be O I$ +ve number 1: those - St wr 00 be 2 1 —ve number is There - i Negative Mmumbes : Wit® be stoved 1 as Compliment - Woy to find ans Complement % Is complement + | Firp Oo te 2 £ | 459 0 Ja cooooll!| § Tut tor undwutandira 8 Ii itlooo = Is complement bits. i 1llooe I It] loot Sas comblement a4 +l = lo * binowus \ VUQGINITU WILT van cliseug (ht a =-5 Step! Tgnove Negative Ss gn : a 5 te [Stepa Find binary equivalent ef 5 Coo... Olol Steb 3] Find 2 Complement Lhi-- Loto lold sas complement This wasp =Vve Numben Is stored fa he Memory u ~vend. <—QIt_- How te read fram memory, Just find 2 Comblement 006--~oloo \ SIO CMETOR onl 7S 7 Buk we have abme See fivet bre tn mem checahbatee se fase — (E'S a negative ‘umben ene Ans > -5 = Tntenreshn: pal Tel Teak ae Hous we gek fe Baas ahctna ate Ha fo seod_ ot tha bm oy Yt ve \ vvuaiicu wiur vam classmate Date. This is known by the data type ured: Staned v unsigned. hota type nest ci tore ale 2 the Numbers whether [tve »-ve Or O Sn we store th egative voluios For e xamble =Lunsigned Inké_ wr2l Rave rings ei 0 te “ase =| We By deSautt » data type wilt be signed - Range st signed int wil? be -2%! to a8! =i. | Q 3? Divide tate 2 he Qi aal 3 Thats why taking 23! in the Yange - Beneuc for nm bits Signed 3 -ar! te ar! -1 Unstgned © te Qrh-) [Ty pecashng Convech ng ane ty af obeys tant — data ty be Cha ch = 97 5 7 Lnteger te chaxackr. COUEKOh yy at ive Q An oukpuk = 6b) $4 Chonacker th Tnkegeu Int pum Couk << num 57 five 98 QA oukpur ———svanrret wittuvam Imp treit. Type OIE e Ut riwtnee nine See ny This is outro matic type casting. The above. examples Were sf [mpliert type conversio fox tubecashng. a leak A= (Float) 2 3 a 2 heudaka type wit be mMmenitioned« _ ( Opexators in C++ Axith mehc operators mC) toss Rs 1, th ane ancth metic openator. — [Foe=is b=3 (i cCouk << G@/b) < The giver olb a. a Note 4 fine = fnt fleat = Float » clouble = douse — Int tint Pre Int = float , Floak = fioab Float Flook 2) Relational Obenator: 29<, >=5

You might also like