This simple program print out grade of students. If a student had an A, or B or C and so on.
The user will only be require to enter his or her scores. e.g 70, 80, 90, 10, 0 etc. and the program will tell if is an A or F etc.
Load your QBasic and type in the following code below;
CLS
REM A program to display the grade of student
PRINT TAB(30); " GRADE CHECKER"
PRINT
DO
INPUT "Enter Score of the student:", score%
SELECT CASE score%
CASE IS >= 70
PRINT "You have an A"
CASE 60 TO 69
PRINT "You have a B"
CASE 50 TO 59
PRINT "You have a C"
CASE 45 TO 49
PRINT "you have a D"
CASE 40, 41, 42, 43, 44 'Note this usage
PRINT "You have an E"
CASE 0 TO 39
PRINT "You have an F"
CASE ELSE 'Score less than 0 entered
EXIT DO 'Exits from the DO...LOOP
END SELECT
PRINT
LOOP
PRINT "Press any key to continue"
PRINT
a$ = INPUT$(1) 'Wait until user presses a key
After typing press F5 to run.
Enter a number to check grade.
You can copy the code from the textbox and paste
Feel free to drop comment/question
The user will only be require to enter his or her scores. e.g 70, 80, 90, 10, 0 etc. and the program will tell if is an A or F etc.
Load your QBasic and type in the following code below;
CLS
PRINT TAB(30); " GRADE CHECKER"
DO
INPUT "Enter Score of the student:", score%
SELECT CASE score%
CASE IS >= 70
PRINT "You have an A"
CASE 60 TO 69
PRINT "You have a B"
CASE 50 TO 59
PRINT "You have a C"
CASE 45 TO 49
PRINT "you have a D"
CASE 40, 41, 42, 43, 44 'Note this usage
PRINT "You have an E"
CASE 0 TO 39
PRINT "You have an F"
CASE ELSE 'Score less than 0 entered
EXIT DO 'Exits from the DO...LOOP
END SELECT
LOOP
PRINT "Press any key to continue"
a$ = INPUT$(1) 'Wait until user presses a key
After typing press F5 to run.
Enter a number to check grade.
You can copy the code from the textbox and paste
Feel free to drop comment/question
0 Comments