Friday
October 24, 2014

Homework Help: computer

Posted by ami on Friday, March 11, 2011 at 9:38pm.

A-Asking the user to pick a number between 1 and 20 and having the computer pick a number between 1 and 20 and telling the user if they won or lost
B- For finding the logic error in the program
C- For finding and fixing the logic error in the program
D- For finding and fixing the logic error in the program and including one full paragraph in your *.rtf file explaining the fix.

Below is the code






REM Guess a number between 1 and 5

[Start]
Answer$ = "Y"
DO WHILE Answer$ = "Y"

REM the statement below is the way the computer guesses a number
CompNum = INT(5 * RND(1))
CLS
INPUT "Guess a number between 1 and 5 "; NUM
IF (NUM < 1 OR NUM > 5) THEN
PRINT "That number is not between 1 and 5 "
GOTO [Start]
END IF

IF NUM = CompNum THEN
PRINT "Correct!!!"
PRINT
PRINT

ELSE
PRINT "Better luck next time"
PRINT
PRINT "I picked "; CompNum
PRINT
PRINT

END IF

INPUT "Would you like to play again "; Answer$
Answer$ = Upper$(Answer$)
LOOP
END

Answer this Question

First Name:
School Subject:
Answer:

Related Questions

math - A certain computer program lets the user pick a positive number, ...
computer - distinguish between computer data represented by the start of a ...
College Computer - Distinguish between computer data represented by the state ...
computers - distinguish between computer data represented by the state of a ...
computers - o Distinguish between computer data represented by the state of a ...
computer - distinguish between computer data represented by the state of a ...
Java - Write a GUI application that prompts the user for a number between 1 and ...
Programming in c++ - Write a program in c++ that inputs a number [1-12] from the...
Program Logic Design - create a flowchart that shows the logic for a program ...
Computer Science (MATLAB) - I had a test in my computer science course in which ...

Search
Members