Hello, I made this program that has random values and you have to choose to say if the next number will be higher - or lower. I completed the code and successfully had no errors but when the user is mistaken nothing comes up. Am I missing something?
// Code Shark
#include <iostream>
#include <windows.h>
#include <string>
using namespace std;
int main() {
srand(time(NULL));
unsigned int digit = 0, digit2 = 0, correct = 0, wrong = 0;
string answer;
do {
system("Cls");
digit = rand() % 9 + 1;
digit2 = rand() % 9 + 1;
cout << "Digit : " << digit << endl;
cout << "Correct : " << correct << endl << endl;
cout << "Will the next value be Higher, Lower or Equal : ";
cin >> answer;
if(answer == "H") {
if(digit2 > digit) {
cout << endl << "Correct!";
correct++;
}
}
else if(answer == "L") {
if(digit > digit2) {
cout << endl << "Correct!";
correct++;
}
}
else if(answer == "E") {
if(digit == digit2) {
cout << endl << "Correct!";
correct++;
}
}
else if(answer == "H") {
if(digit2 < digit || digit2 == digit) {
wrong++;
}
}
else if(answer == "L") {
if(digit2 > digit || digit2 == digit) {
wrong++;
}
}
else if(answer == "E") {
if(digit2 > digit || digit2 < digit) {
wrong++;
}
}
Sleep(1000);
}
while(!wrong);
cout << "You were correct " << correct << " times.";
cin.get();
cin.get();
return 0;
}