08-31-2003, 11:22 PM
Here is another assignment i am working on for class.
"Create a program that tests a students ability to multiply 2 random numbers between 1 and 9. The program should continue until the student enters a 0 for the answer. It should display whether an answer is correct or not -- display the correct answer if it is wrong -- and the number of questions, number right, number wrong and percent correct. The use of color is an added plus."
Here is what i have so far. . .
CLS
Start:
CLS
lowerbound = 1
upperbound = 9
RANDOMIZE TIMER
num1 = INT((upperbound - lowerbound + 1) * RND + lowerbound)
num2 = INT((upperbound - lowerbound + 1) * RND + lowerbound)
PRINT num1; num2
INPUT answer
DO
IF answer = 0 THEN
CLS
END
END IF
IF num1 * num2 = answer THEN
PRINT "ANSWER CORRECT!!!"
END IF
GOTO Start:
LOOP
END
The part i am working on now is to check if the output of the numbers showing on the screen is equal to the answer inputed by the user & to display ANSWER CORRECT. Its not working though. What am i doing wrong?!
"Create a program that tests a students ability to multiply 2 random numbers between 1 and 9. The program should continue until the student enters a 0 for the answer. It should display whether an answer is correct or not -- display the correct answer if it is wrong -- and the number of questions, number right, number wrong and percent correct. The use of color is an added plus."
Here is what i have so far. . .
CLS
Start:
CLS
lowerbound = 1
upperbound = 9
RANDOMIZE TIMER
num1 = INT((upperbound - lowerbound + 1) * RND + lowerbound)
num2 = INT((upperbound - lowerbound + 1) * RND + lowerbound)
PRINT num1; num2
INPUT answer
DO
IF answer = 0 THEN
CLS
END
END IF
IF num1 * num2 = answer THEN
PRINT "ANSWER CORRECT!!!"
END IF
GOTO Start:
LOOP
END
The part i am working on now is to check if the output of the numbers showing on the screen is equal to the answer inputed by the user & to display ANSWER CORRECT. Its not working though. What am i doing wrong?!