Created the guesser.cpp

This commit is contained in:
Mathias Wagner 2023-09-28 11:48:54 +02:00
parent f95d13537e
commit 4c33528156
Signed by: Mathias
GPG Key ID: B8DC354B0A1F5B44

21
guesser.cpp Normal file
View File

@ -0,0 +1,21 @@
#include <iostream>
using namespace std;
int main() {
srand(time(NULL));
int random = 1 + (rand() % 9);
cout << "An welche Zahl denke ich? ";
int number;
cin >> number;
if (number == random) {
cout << "Congrats, die Zahl war richtig. :)";
} else {
cout << "Leider falsch. Die richtige Zahl war " << random;
}
return 0;
}