0% found this document useful (0 votes)
51 views

Qbasic Notes

Qbasic_notes
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)
51 views

Qbasic Notes

Qbasic_notes
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/ 16
| What is @GBASTC 2 aim wie wedi Bd 2th’ A rap ol 4 QBASIC iS One of the easiest high sheveds programming Jaaguages which was developed . by Psofessoy¥s John Kemeny and :thomas Kustz+ tibre ae? bll Feature of @BASIC gigar bar aetpregqe a: Easy to leaxn: and undexstand - Levibe Sup pox4s: \gtauctureds /pyogxamming c Allows vs to waite and xun _PyOQ%aAMs im mediaté by arc ott ye ig) Ci Elements of OBASIE Pao guamming by G1 AL a OBASIC: -chave.ctew. set: \ “Dray 'sval Ww ODiAw be Vowiabre pap ov osaweA snaol Cc: Constant YY P19) An Bay d- Opexatoy and aaa ! roSa 2OOt ot we PR aD e Keggoo nd, ( Resexved woxds) _ mi xu wid tdey 8d qi| Chovactey Get SPI 2 Choractey set is a se} of valid> charactexys + || ¢naracre hot @ language can ; recognize: 1 + Alphabets 2A to Z (smait £ capial s ters _|| * NUAGerS ad BS qi + Special charadeys Date Page pl Vaxiable dagte bh Coding with DD ei ocVOxiObletoare ane Siwxage lveations inmdher computer's memory 2 liy “ana ed) UP Ro ae _|| Num exic vaoxidble Stxing Vasxiable PUbieo Diy simel q. Numesic variable The. Numexic: vaxiAble has a numbex ag its, value: Srolpees Ex! \ ta phe OX Divs Mes iy exo # ‘ S ah > Ay Qh. area pz oqa lesttomns diem A214 ! b. Staing variable bs ois y ar) The! - Stsing Veviable has a as Low RS yet i stsing of chdraciexS ox dlphanumesic tse valwericno) gmefc 0 pote tl Lutsy cohiging GAG apigdath toriguaten =. - bak erent wot ‘ 43014 Consrant Coding with BB— ee ee he Constant ig: a data Hemp whose 1c valve does not change dusting: othe execution of a progxam- = lot igiy Mt Num exic astant xing. - A KS ‘ ax. Numexia., Constants torre gous tie NumexiG Constant 18a sequence of posittve ox negative: num bexs on pextoxmed. By iad? a which mathematical opesdtions can be | Ewes ui uu, (S2n730,,, 419 ia \ = ‘b-Stwing Constant Staing Canstan+ is a Seq vence of characieyS tdhich imay include Numbers, lertexS Gnd cextain special charact€xs enclosed in quoiaston masks: Ex: "Dipesh™, “apple” Coding with,DD _ _ Page Opexatox And Expression» -\ 1 % sOpesatoys. are dhe) symbols re presenting the operations they peyfoxm. Expression ig referred as dhe combination of an operatwxs and i+s operands: \ Does Sse ——— Ax iable d&eo sum: = Qt + 6 Ss Ope xatpy¥sS.s vince Types i = . L a ie OOo oe 4 ae) Axithmetion Opes goers! foaa be Relational Opexadoxs © \iaay <= ; A<2B = : AS=Q_ <> AL> @_Logical OpexatoxS Opexato™ Example AND A>@ AND ADC OR A>B oR A>dC NOT A NoT B @ concatenation opesttoxS Bg =" Cake” ws Ag = B¢ + "is"+ “sweet " Owput: Concatenahon opesatexs Cake 16 sweet a a eh Date ___—— Page —___ Keywosds (Resexved words) Exé “- CLS, PRINT , END QBASIC Statements SR SSE StOrem COTS [> REM Statement CLS Statement p> LET Statement (> _INPu7 Statement b> Read.. DATA Statements > PRINT Statement > END Statement chase | Coding with DD. Page _” Q@) REM Statement It iS used +o explain what a program does and what > specific lines of code do- Ex: REM "This pxrogrom calculate area " b) CLS Statement Ti is used +o get the fresh screen OQnd_ cleax +he left ovex previous Pe ogxam. Ext Gus ¢) LET Statement 17 It is used +o assign the value of an Expre Ssion 40 G vasiable: Ext Ld) INPUT Statement Th is used +0 accept the value ‘of any. variable from usew: Ex) CLS . t INPUT. “Entex length": £ 9 INPUT "“Entey breadth "> b- Areq = Ayb PRINT “Area is: Area END le) READ. DATA Statement It is vsed to read values from DAIA Siotement And Assign 40 yaxrables Ex? READ ab DATA 5G nes —Coding with DD— | Coding with DD Date Page __ TD PRinT statement ii iS used + display data _on the i Screen, \ Ex: 1 PRINT" My name _is Dipesh g\ EnD Statement I+ 1S used tn denote the end of the excgxam- Bx PRoay END Contwo |). State ment pa Branching Stademe nt z SS ; Unconditional Conditional 8.5 j BS | “ y Goto IF.. HEN Statement Statement | { I >> IF...THEA Statement | | = IF... Tuen... ELSE | Stateme A+ | | statement as ol a) GOTO Statement Coding with DB- Ex; Met top: yo TD PRIN T gee > 213 Y= Xe peat GOTO +o0p END 7 b) IF... THEN Statement Ex? CLS O=5 INPUT a Smae IF A>O THEN PRINT "Greater than O n END. ©) IF... THEN-..ELSE Statement Ex? CLS INPUT Q IF O>1 THEN RRINT " NumbeY iS , : ext Ss -EWD greater thQn 4" ld) IF.. ELSEIF... EMDIF- Statement Ext CLS INPUT a 4 IF 054% THEN . PRINT “He con dxive ELSEIF a< 4% THEN PRINT “ne _can't_dyive” ELSEIF a=4% THEN FRRENT "Visit dviving centex” ELSE PRINT "Sonething exvox” EN DIE END Coding with DP | Looping Statement [ FOR-.NExT WHILE. WEAD Do.. LooP Statement Statement State me ot Ex’ : , wey tf t= \ CLS x ; 3 S Bg — ICL S Z| FOR [2 1s¢0.10 ead. | 3 Aber Sosa i NE: EXE \ PRINT } Jew D. 5 4b 2 tS, ——— mr . Ls Ve \ 3 SAN WEND oy/ U @2) EyD (a ee C 1 Con L a 2b is the Stovage |y It is a dota Hem | locavons in the whose value dues not] Computer 's memoxy.| chonge dozing tne | : execution of Q pxngaan| 4|| Vaxiables are 9. Consiands are specially vwoxitten in usually Wwaitten_in | Jette ¥S ox syumbuls-}| Numbews - , | +3} Example: = 1a: Example! ‘Jee 5 | } - — Numeaic Vv GaigbVe t NORERT Constant NO eegreee wet b ft [ = » Dipesh Ww _ ua. 1 | as; pega : 4 : ers [ Sting _vasighle es String con Stank c : 1 i ig [SS = == +4 f-

You might also like