0% found this document useful (0 votes)
2 views17 pages

C++ Programming Notes

The document provides an overview of programming fundamentals, including the definition of programming, the role of code, and the importance of programming languages like Python and Java. It discusses the process of translating human-readable code into machine code, the concept of variables and data types, and the use of comments in code. Additionally, it covers operators, type conversion, and preprocessor directives in programming.
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)
2 views17 pages

C++ Programming Notes

The document provides an overview of programming fundamentals, including the definition of programming, the role of code, and the importance of programming languages like Python and Java. It discusses the process of translating human-readable code into machine code, the concept of variables and data types, and the use of comments in code. Additionally, it covers operators, type conversion, and preprocessor directives in programming.
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
ben: | 1 Date Léctuee # 1 W@WRHS PRO qRaming —FunonmenaLs. i Software —- ~~ ——}—_is 0 sot of instructions 4 i pe Pingtomming 1 ~< is the process __ fp 2 giv ig a et f instructions ~~ to comput ey fey Specific " task - me || Computer does pot unclerstanch Y hbaman fanguage So we use 1 i faagnese o_Like | (Python, Java sevipt » ¢ ++) components of programming = | * || Code :- 1 the actuad text —_savitten iiad 0a Y, 1 the. apf —laage = . i is rd a A step by stea pln __24—;— = y Fe ee 2 x J oe BAAS | = —_—= F oe Date: , f t Cae — | ————— dranslate human = 1eadable cod “ into machine __code (Ae andosy) oo that _the compu ter hardware | ge | can exocute+ — => || Converds high leved faosunne — tp machine sonyulege 0,1) : - - => Assembler = ~ Converts assembly ea e to ow bevel ensuage oy = machine da - og — Whot is assembly tanguage e = e This fanguaco 1s. basically Cou e deve d | 0 : ou a hea. ts ‘mu lay. to machine 4 eo langage, tut aes human ss readable I nid e~ | fastead of ~Ainaty J getutn O49 } Jd It i a—__headoy # include _2 iostveam > os that fet us work with input and out put. # include = To Add ister if we dont write this commacil ‘| then __we have _4o tdtzcout which js difficwlf aad time fonsuming Thi command make ouy sor Ic Stayt y that i. woutten ot fa. tro, rye Il the =o Any thing brackets will be th a main Lines progiaa: tn the Key _poith_s The __blank codes: Crt ignores white ces» But we use it to make progam mare __readable cout 24 "Well world” , cout __méans __= chevacter output ll hake means = fnsettion specatet fell us that tho _4ext They J written 7 « % will be » (commas end of out put Semicolon 3 = Jn c++ at the dine semicolon st aa oloioraeerrTr rey ry ges i every J tells _ that necessary - J+ ig 1 the stot ment i. enclond - | ¢ #9\9 9 5 e + DAES accininetenm OO@AmAS =F : + | vetuvn O04 @ | ends the main function - ~ | . $ qt Special _SymgoLS += “| comment :-() e (2) commenk isa _ text, a that compi bes can not, __veach e Ht ps ignoves it- ~ Tt hos tuo types - a, Single line comment = _// ~~ Ignores only one line ~~ for og t= Lf This is my fitst preguaun = Compiles will ses the line» “6 = fine ___cormments:- _*/ ov [* = =} Compi ler will ignore all _the =. Vines with this symbol afs > Lf we want comnpi Ler a spect fic fine - then * my Lif preguam J” | “wull .- be used = + ident (fiers consist of i thavactevs + Some ave _pre= de fined | i fiey hile ——— User- defin od identif fers cin Palo» 9 4 ¥ a ole | 7 BAmMAmE Ct+ variables: at fab le is Orlow | evat inex box for __stoxing data Nalue: type of variahles « yilint -> store integeves without decimals 23 01-2 2) | double >store _fleating numbers with decimalgls 14-44 3), Char = store ingle hayacteys => AsB4¢ | uw || St¥ing-» store text ~s Hello £)i bool > Ste val \ = Fals =>| Dato Types :- numerical data types = integers 5 float alphabetical data types = bance te => 1 integer _= bytes —(moxe_spuet a => chat = 8 55. es ae (Dhen create voit inbles = —— ys wy — © 7 fll = 4 bytes 4 1 clouble = % Byles 41. ship x>x % 3 @ nan Re a en Date OO@OmE “Sy | Rues FoR _VARIALE._NAME. > — 9. Space __vestriction my Age x, my Age ; = wt stent —with —number Lage x slage Lv, ~€ 3)_\Speei chavacters ast allowed @ageX _» age a i | ~e. vaviabk name. int , flood X name lage ~~ “@) Variable name __dloes pot __ctayt —Q) | Whoet is variable itn a programe Noariab le. 1 a _namedl memory Qocutian in which Prtagpresnn stoves their clata - w we add navia b (e. computer allocates oy weseyo Space in RAM for that data - “+ ara —* exemple: int age = 25 => salut | /- -_ a + vit as come feel — af preceddnce f M1 epee MDMMMs) ~ = ~ 7 same. Ney | Rug} py $- ave at tar Level __| ~ | af ecendoace _ ~e at 7 ~e tho ‘Oxs vi ame eveb ill solve fom left __ fo ight in AYogyam te We “| Ex ion - Thoye ave _thyee. Lupes: Lategyral expwession = Al operands in the exptession oye integers. ( 13a.3,4 4,0) 8) Fleoking. point_expression = A pperands in___the expression are decimals (4S , a-£ Cass) ‘Mixed. expressinn = fi_foth integer andl _clecrm numb ef te a (as +3) Te ee ee L it ab bho \ a WA@AR~, > —# What is __operanel¢ Operands are a items _s constant abl | which on _ppevatar _ Pevfiven action. age \ 7a — ef — specand -y-lnaty _dperand. = - WwW 13 Date: OM@OmS Type__ Conversion (CASTING) = __ Sometimes the _ value of one deta. type conve(ts & automat ically fo __anothey data pt elt oo at tt This evwy is implicit Hype coercion: To avoid this _ eyo ine —_lise p—éasting » type conversion aif Paaticy: Syortane = Stati (1-4) | this evaluates to | 1 mei ie er rT tT. TT UT dd Oe UU OP I4 — te See | Allocating __snertons p or = ao The__Nalue of nable yf will beteerco Mereemeoy: an pot he : changed thy out the peg ein Syntax +2 4 const dle pe vaviable = value ¥ ‘ 1 || Constant i veserved word 4 example | const double age = Al 3 = = The ___volwe of double _ data type will not _be changeable thro, the progiam- In that Date: OUMNH 15 Example» aoe a ___iat age 5 _ cin_>>_age This is input sh Uses the current value ~e- Se pe. ~“e “é —e——4-|-cin_x_Tells the computer to take input ~~ fvom__usey- ~S. Wills»: Takes entered data from v ~~ assign it__4o _vaviable ~~ v/Al + fable vy inter ne ~~ fores- ad > ~@ —Increment_¥ Decrement Operators , Tnevement 3 ~ Tneveasing the value of yaviallle 9 by 7 - ~2 ; cS Types sf Increment += ~~ &)| Pre - Inctement :- (Prefix) —» Increases the value first , | —o then uses it in the _ statement —o Syntax = tt ej = b)| Post = Increment :- (Postfix) | statement _fiyst then ___incy eases" ——— i,” 16 fe @OORAw : Oi a = i} _ | the value= ——$ ad syntax: —® aoe = __y_| Exampley & - || \int w= Si _ | se ths x becomes 6 a i : o —__a) Decyement = = i Decreasing the value of = é - S vaviable by ____________> - pes of —Derament . = mH Predecyemeot :~ - 7 | Deveases the value first, = - [ thon uses it in the statement - > a syntox = == % j = |p, = a), Post clecyement :- > 7 Uses the _cuvyvent value || ~ io __statement then _clecvease the _| = Value dy. Econ bea 4 7 int _ “x = Sy _ sa sal | 4 p___ Date: —__ MMO mw 1, Pre process _ Divective = » eaeaeeeae E Bo] jeeeeth sles Oe Command Z yl that tells the compiler _to . mod ify or YOPay the ourxce. {| ; ode before compiling it: pu It __alinays begin with ca | --Preprocessox divectives ave processed by progam called preeprocessoy - # ihelude Cstring > JI fring hardling Syntax = _# include 7 iostyeam Header file Girvary byavy J # include J C Math ‘brats Py ee eR OM Or UP td

You might also like