Thursday, 3 February 2011

To be completed by 8/2/2011

6
Question 4
Create a folder/directoryQuestion4 for your new program.
The variable table, Table 2, and the Structured English algorithm describe a simplified
version of the Guess the Word/Phrase Game.
Table 2
Identifier                  Data Type        Purpose
NewWord               String               Stores the setter’s word to be guessed
UserWordGuess      String               Stores a word that is the user’s guess
OUTPUT "The new word?"
INPUT NewWord
OUTPUT "Your guess?"
INPUT UserWordGuess
IF UserWordGuess IS EQUAL TO NewWord
THEN OUTPUT "CORRECT"
ELSE OUTPUT "INCORRECT"
ENDIF
What you need to do
Write a program for the above algorithm in the programming language of your choice.
Test the program as follows.
Test 1:Input of the new word EAGLE followed by a correct guess.
Test 2:Input of the new word BEAR followed by an incorrect guess.


Save the program source code and screen shots of test in blog

1 comment:

  1. Var
    NewWord:String;
    UserWordGuess:String;
    Game:string;

    begin
    Repeat
    clrscr();
    Writeln(' Guess My Word ! ');
    writeln('Press ENTER to Continue');
    readln();
    Writeln(' A- Guess my 3 Letter word.');
    Writeln(' B- Guess my 5 Letter word.');
    Writeln(' C- Guess my 10 Letter word.');
    writeln(' D- The Big one - Guess my 20 Letter Word');
    Writeln('Select a Game: ');
    readln(Game);
    game:= Uppercase
    until (game='A') or (Game='B') or (game='C') or (game='D') ;

    Clrscr();
    if game='A' then;
    begin
    Writeln('Guess the 3 letter word : ');
    readln(UserWordGuess);
    if UserWordGuess = cow then
    begin
    writeln('You guessed Right!');
    else if
    writeln('Try again')
    readln();
    end.

    ReplyDelete