qbasic statements for class 7
Understand Qbasic, Qbasic, how to use it and how to program using QBasic. This tutorial we’ll guide you throughout each step by step with example and explanation.
In my last previous article, I have entirely written many tutorials about Qbasic and some other related to programming. Some are ” list of ND1/DIP1 computer science course,” and the other is “ ” and I have also completely written some highlight post that is related to this active reading post “ three things to known about as a computer science student Qbasic programming example and exercise” so that you can take a look at it. As I have said everything in my last post, so today let look at this tutorial and make sure you understand each of the steps before processed to another step. Qbasic statements for class 7, class 8 and 9 with example?
I am going to show how to program using Qbasic for class 7 and class both 9. this ebook contains hundred of Qbasic statement and tutorial plus example. keep reading to learn more about
Qbasic. CLS STATEMENT IN QBASIC? In this statement tell you how to program and how to display the result of every program input into the Qbasic. The CLS statement refers to (clear screen) this means that the CLS moat clear the screen before the new program can be appropriately displayed. The CLS clear the screen the old program data and then display the result for the active program, and this program can here display by pressing the F5 key. CLS EXAMPLE 1.1 CLS REM “EXAMPLE 1.1” REM ” MARK WROTE THIS PROGRAM” PRINT MYSCHOOLTUTORIAL END OUTPUT RESULT
They are how to write a Qbasic program to clear the screen and then display the result, don’t forget to press F5 key to run the program.
REM STATEMENT IN QBASIC? This second keyword you would learn is REM. REM command tells the programmer what the program is all about, and it also makes it easy for the reader to understand what the programming is about if a or b. REM means “REMARK” it is used to add value to program or comment in Qbasic. Let me show you how the REMARK statement works on Qbasic. REM “EXAMPLE 2.1” REM “PROGRAM TO DISPLAY WELCOME TO QBASIC ELEARNING SITE” EXAMPLE 2.1 CLS REM “EXAMPLE 2.1” REM “PROGRAM TO DISPLAY WELCOME TO QBASIC ELEARNING SITE” REM ” WRITE BY MARK ABAHI” PRINT “PROGRAM TO DISPLAY WELCOME TO QBASIC ELEARNING SITE” END In QBasic, we use the REM statement as shown in example 2.1. Please always leave a space after you write REM. Means it sometimes look at your program he/she would be known who it or what your program is about something. PRINT STATEMENT IN QBASIC? You have understood CLS in example 1.1, and you have also known how to use REMARKS in your program and how to clean the screen. The next statement should help you to write something on the screen. The PRINT statement is one of the most useful and powerful statements in QBasic, and it is effortless to use. You’ll learn it later, all you have to do is to type PRINT and a sentence between the ” ” use of quotation mark to print a message. The PRINT statement here used if you want to display the result of the program in QBasic. PRINT “HELLO TO PROGRAM” EXAMPLE 3,1 CLS REM “example 3.1.” PRINT ” I love Myschooltutorial.” END When you write that way, the computer print the massage tye used the following program and press F5 to run the program. LET STATEMENT IN QBASIC? I have previously published the LET statement with the example in my “QBasic example and exercise” so that you may take a look at it. The LET statement is to give a direction or value to a QBasic programming> LET here used when referring to print the result of a particular program inform of calculating or evaluate to print Basic program. LET A = 10 LET B = 10 LET C = A+B EXAMPLE 4.1 CLS REM ” example 3.1.” REM “program to calculate” REM “write by mark abahi.” LET A =10 LET B = 110 LET C = A+B PRINT C END Here is how the LET statement can be used and always may sure to press f5 key to run the program. If you have not yet read my previous post “QBasic programming example,” may sure you go and read it now. FOR STATEMENT IN QBASIC? FOR statement means (FORCE), It when referring or expressing a mathematical program or logic program in QBasic.Here in section 5.1, you should learn how to use “FOR” statement when writing a QBasic programming. FOR A EXAMPLE 5.1 CLS REM “example 5.1.” REM “write by mark abahi.” DIM value AS INTEGER FOR value = 100 to 10 STEP 1 PRINT “number =”; value NEXT END EXAMPLE 2: USING FOR NEXT STATEMENT? CLS REM “example 8.1” REM “program that demonstrate NEXT” DIM value AS INTEGER FOR value = 1 to 100 PRINT “Number =”;value NEXT END
Press F5 to run the program, and the result should be like this as shown in image 5.1.
<image INPUT STATEMENT IN QBASIC? INPUT statement is used to add value in the program, asking or requesting for information. Apart from storing value and words in variable QBasic allows you to ask people questions, receive a response and store them. You store the response in the variable. However, to put the response in a variable, you need an individual command call INPUT. You can INPUT numeric or string variable, and you should learn how to use the INPUT statement in example 6.1 of the article so keep reading. INPUT “what is your name?”; name EXAMPLE 6.1 CLS REM “example 6.1.” REM “program that uses a string variable.” DIM MyName AS STRING INPUT “what is your name?; MyName PRINT “hello”; MyName END Press the F5 to run the program. The computer would prompt you for your name; note that this prompt was the same specified in the INPUT statement above in quotes. The computer is them waiting for you to enter something. Respond to it by typing your name. if you have entered, say mark, the computer prints “MARK.” <image IF THEN ELSE STATEMENT IN QBASIC? The IF THEN ELSE statement is used for deciding on the QBasic program. Let said, how do you write a program to take a decision? As an illustration, let us consider how we make decision suppose one of your friends give you a phone call and ask you what you’ll do in the future and you answer. IF I finish my school THEN I’ll receive my certificate ELSE I’ll travel to meet my brother. In QBasic, we use the keywords IF, THEN and ELSE to take decisions. You can write a program to look at two variable and see if they are equal or if one is larger than the other one. This section, you should learn how to use the IF THEN ELSE statement in QBasic programming. Let me write a small program that checks to see it two variable have the same number stored inside them. EXAMPLE 7.1 CLS REM “example 6.1.” REM “program that checks to see if two variables are the same” DIM FirstNumber AS INTEGER DIM SecondNumber AS INTEGER INPUT “enter the first number”;FirstNumber REM- the sign = means equal to QBASIC IF FirstNumber = SecondNumber THEM PRINT “FirstNumber is equal to secondnumber.” ELSE PRINT “first number and secondnumber are not equal.” ENDIF END Please note, you have to write ENDIF to tell the program that the IF has finished and press F% to run the program. NEXT STATEMENT IN QBASIC? Now, you shall learn the keyword NEXT which can be used to get your program to do something for shipping or a certain number of times, a NEXT statement work when using FOR statement in QBasic. You should learn how to use NEXT in QBasic on this tutorial so keep reading. NEXT A EXAMPLE 8.1 CLS REM “example 8.1.” REM “program that demonstrates NEXT.” DIM value AS INTEGER FOR value = 1 to 100 PRINT “Number =”;value NEXT END
Press F5 to run the program, next section.
WHAT ARE THE LOOPING STATEMENT IN QBASIC? In QBasic, the use of a loop to make decision, control how computer to perform the program. Looping statement is significant when writing a program that switches from lift to right in QBasic. We’ll discuss this in the next section of example 9.1 so keep reading. LOOP, WHILE STATEMENT IN QBASIC? Making your program loop, we have recently discussed a program in some chapter on “learn QBasic programming” so that you can take a look and read it. In today topic we shall discuss two ways in which you can make your program loop or do something more than once, using the WHILE and FOR statement. Let me write a loop program using the WHILE and FOR statement in example 9.1. LOOP 2 WHILE GuestName <>MyName EXAMPLE 9.1 CLS REM “example 9.1.” REM “program that keeps going until you guess right or enter stop.” DIM MyName AS STRING DIM GuessName AS STRING MyName = “Mark Abahi” INPUT “what is your name?”; GuessedName WHILE GurssesName <> MyName PRINT “sorry! you are wrong, and I am not”; GuessedName INPUT “what is your name?”; GuessedName WEND PRINT “Yeah! you guessed right, and I am “MyName END
Please note, just like IF you had to use ENDIF, with WHILE you have to use WEND. Run this program to see how it work. Notice how the INPUT statement has been used before WHILE and before WEND.
In loops, the variable you are testing in a WHILE statement must be given a value before entering the loop. Notice also how indentation has been used to make the scope of the WHILE and the if statement clearer. EXAMPLE 2.2 USING WHILE STATEMENT? In this tutorial, all the sign you learned with IF(<,>,<>,<=,>=,) can be used with WHILE. Let look at an example of using the number. EXAMPLE 10.1 CLS REM “example 2.2” REM “program find the average of number” DIM counta as INTEGER DIM number AS INTEGER DIM total AS INTEGER DIM averagevalue AS SINGLE Counta = o Total = 0 INPUT “enter first number”;number WHILE number > 0 Total = total = number Counta = counta + 1 INPUT “enter next number”;number WEND PRINT “sum total is”;total Averagevalue = total / counta PRINT “average value is”; averagevalue END
PRESS f5 TO RUN AND TEST THE Program and please note that the WHILE checks for a positive number.
SUM STATEMENT IN QBASIC? The SUM statement: it is the statement in QBasic that helps calculate the SUM of math, evaluating in QBasic programming. In this section, you should learn how to program using the SUM statement SUM B SUM C EXAMPLE 11.2 CLS REM END Press F5 to run the program, next to level. WHAT IS THE USE OF END STATEMENT IN QBASIC?
Just like I have said this on section 12.1 of this tutorial, that the CLS and END statement is the most critical part in Qbasic programming, END means to end the program in Qbasic. If you write a program in Qbasic and you forget to write END. If you press run. The program should display, but won’t display in some computer or program it depends on how you write the program. You should learn how to use END statement in example 12.1 so keep reading.
END STATEMENT IN QBASIC? The END statement in basic programming is the essential part every one of you should take notice of this it. It means that every programmer in QBasic most uses the END statement in other for the computer to display the result correctly. The END is compulsory just like the CLS statement, I have used almost END statement on all my program in this post you can check and see it by yourself. Each example, I used END statement in other for the computer to print the result correctly. You should learn how to use the END statement in this today tutorial so keep reading. ENDIF END EXAMPLE 12.1 CLS REM “example 12.1” REM “last END statement.” PRINT “this is the END of today tutorial.” END As shown in example 12.1. That is how to use an END statement and don’t forget to press your F5 key to run the program. DOWNLOAD QBASIC TUTORIAL, STATEMENT FOR CLASS 7 PDF? Download my ultimate guide to QBasic programming; recently I come across a question on google.com, people love searching for the keyword QBasic tutorial pdf. Moreover, I note that none author has published this answer on he/her website yet, I decide to pick and write the answer base on my knowledge. So today I decided to release the “ultimate guide to QBasic” pdf for free download. I almost spend my time to write this fantastic ebook that should solve your painful work. This ebook is 100% sure for beginner guide tutorial in all class, is available to download for everyone who wants to learn and become the successful programmer in QBasic. In my ebook “ultimate guide to QBasic,” it contains a lot of tutorial in QBasic you can support me by donating any amount for my hard working to get and then the ebook entirely for free on $2.55. Download now, save data, read anytime anywhere, become successful in programming. FINAL WORDS AND CONCLUSION? Said YES to this TUTORIAL, YES to download my “ultimate guide to QBasic” on first and second QBasic. That I have thoroughly answered to all your painful work. Moreover, we promise to keep you update on the post that is related to programming example QBasic java, and C++. So we highly recommend you keep visiting Myschooltutorial, and again we do love to hear from you? If you found this post helpful or you want to share your, or you have a question to ask, feel free to drop it via comment and make sure you download the ebook $2 is nothing, to be familiar with it, read anytime, save time and said happy day to programming in QBasic.\