#include #include #include #define MIN 1 #define MAX 10 using namespace std; int main() { srand(time(NULL)); int gesucht = MIN+rand()%(MAX-MIN+1); cout << "Zahlenraten zwischen " << MIN << " und " << MAX << endl; int test; bool gefunden=false; while(!gefunden) { cout << "Geratene Zahl = "; cin >> test; if (test < MIN || test > MAX) { cout << "Zahl ist außerhalb des Bereichs!" << endl; continue; } if (test == gesucht) break; cout << "Leider falsch geraten." << endl; } cout << "Gefunden!" << endl; return 0; }