Write a game for players to guess one secret letter. The game should ask the pla
ID: 3532145 • Letter: W
Question
Write a game for players to guess one secret letter. The game should ask the player to enter her guess, then compare the input character with a secret letter(that you picked and programed in the game). If hte player's input matches with the secret letter, the game should display a winning mesasge. If the player's input doesn't match, the game should display a "sorry" message.
This is what I have so far, I don't know how to proceed to actually make it work.
Include Irvine32.inc
.data
string1 BYTE "Enter guess letter",0
string2 BYTE "CONGRATULATIONS, YOU GUESSED RIGHT!!",0
string3 BYTE "Incorrect", 0
.code
main PROC
?
call readDec
mov EAX, 65d
cmp EAX,65d
je L2
jmp L3
L1: mov edx, OFFSET string1
call WriteString
call ReadInt
call crlf
?
L2:mov edx, OFFSET string2
call WriteString
L3: mov edx, OFFSET string3
call WriteString
L_END:
call crlf
exit
main ENDP
END main
Explanation / Answer
#include <iostream>
using namespace std;
int main(){
char c;
cout << "input char " ;
cin >> c;
cout << (int) c << endl; //casting, compares the letter
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.