Before going on code, i will you introduce about Qbasic Programming.
QBASIC (Quick Beginner's All purpose Symbolic Instruction Code) is a high level programming language delveloped by Microsoft Corporation in 1985. It is a modular Programming Language, where program is divided into different modules or procedure. QBasic is simple and easy to learn. It uses English like Keywords and mathematical symbols to write a program.
Features of QBasic Programming:-
- It is simple and easy to learn
- It is an interpreter having its own editor.
- It has dynamic program debugging.
- It supports the local and global variable.
- It supports modular programming.
- It capitalizes the reserved words automatically.
- The syntaxes of the statements are checked automatically.
Starting QBASIC
QBASIC may not be on your computer. At first, you need to have QBASIC in your computer. It is freely available. You can download it from internet as well.
Downloading QBASIC Software:-
In Windows 7, 8, 10:-
I have written a post before this. In this post, I have provided detailed experimental information on how to download and run Qbasic software on your computer.
You can find out how to download Qbasic by looking at this post. After downloading Qbasic you should run Application file.
If there is any problem, please comment in the comment box below..
Now you will see the QBASIC window where you have to write QBASIC Statements to make your program.
Please if the following Images do not clearly displays, click on images to view largely images.
Now we will start write code for the above query.
QBASIC CODE for above Question:-
Step 1:- Open Qbasic Software from your computer.
Step 2:- The following Qbasic Code is used to solve to above query. Write down the following Qbasic Code clearly in the Qbasic software that you have opened.
Rem Write a program to check your School Result.
Cls
Input "Type your Marks"; marks
If marks > 40 Then
Print "Congratulations! You have Passed!"
Else
Print "Fail! Word Hard!"
End If
End
In the above Syntax:-
CLS:-
To clear the screen
Input Statement (Input):-
Input Statements are used to supply the data during the execution of the program from the keyboard.
IF .... THEN .... ELSE Statement:-
Purpose: It is a control flow statement that allows conditional executution, based on the evalution of an expression that must be either true or false
It allows contional execution based on the evalutation of an expression that must be true.
Syntax: IF Boolean expression THEN [Statement1] ELSE [Statement2]
- Boolean expression is an expression that must return true or false.
- Statement1 consists of a task to be executed if the boolean expression returns true otherwise Statement2 will be executed.
ENDIF:- It terminates the IF Statement.
Print Statement (Print):-
To display the output on the screen.
After typing the above code in Qbasic Software, you have to follow following steps.
Step 3:- To run this program, Go to Run Tab menu, click to start. You can also press Shortcut F5 key from the keyboard.
After this, click on OK button.
Step 4:- After running the program, following black window is display.
Step 5:- After running program, type your marks and Press enter Key.
The Result displays on the screen according to the marks. That's all.
Step 6:- But don't forget to save the program you have written. To save press ctrl + s key or Go to File Menu, Click on Save button.
Step 7:- Write the name of file in the file name field, Choose the file path where you want to save the file in the computer and Click on OK button.
Step 8:- Your File saved. If you need to edit in your code, you can open your saved file later.
No comments:
Post a Comment