Presentation is loading. Please wait.

Presentation is loading. Please wait.

GROUP 2 SARAH ELEENA MOHD USLI NURUL AIDIL ABD HALIM

Similar presentations


Presentation on theme: "GROUP 2 SARAH ELEENA MOHD USLI NURUL AIDIL ABD HALIM"— Presentation transcript:

1 GROUP 2 SARAH ELEENA MOHD USLI NURUL AIDIL ABD HALIM
NOOR SALBANIAH JALALUDDIN SITI FARAH SHAMSUDDIN RAFIQQAH MUHAMAD SABRI SITI ZALIHAR ABD MUTALIB

2 QUESTION 2 Write a program for a guessing game. The program will randomly select a number between 1 and 100. The user is asked to guess a number. - if the guess is higher, print “The number is higher than that. Try again !” or other related msg. - if the guess is lower, print “The number is lower than that. Try again !” or other related msg. - if the guess is correct, print “Congratulation! You guess it correctly !” or other related msg. If the user guessed wrongly for 10 times, the game ends with “game over!” or other related msg. If the user is able to guess the number correctly, asks for the user’s name and store it in a file. The name will be displayed each time the program starts.

3 PSEUDOCODE OPEN FILE ‘mz1’ READ RECENT WINNER’S NAME CLOSE FILE
GET FIRST GUESSING NUMBER LOOP FROM 1 TO 9 AS ‘W’ IF i != r , EXIT IF i > r ,PRINT NUMBER IS HIGH IF i < r ,PRINT NUMBER IS LOW IF i == r , PRINT CONGRATULATIONS GET WINNER’S NAME APPEND WINNERS NAME END LOOP

4 FLOW CHART

5


Download ppt "GROUP 2 SARAH ELEENA MOHD USLI NURUL AIDIL ABD HALIM"

Similar presentations


Ads by Google