#include #include #include #include "mastermind.h" using std::cout; using std::cin; using std::endl; const int MAXROUND=8; void playRound(MastermindDigits&); int main() { int menuSel=0; int input=0; MastermindDigits game; srand(time(0)); do { system ("cls"); cout << "1: Spiel" << endl; cout << "2: Testmodus" << endl; cout << "Ende: beliebige Taste"<> menuSel; switch (menuSel) { case 1 : { game.makeDigitsToGuess(); playRound(game); break; } case 2: { cout << "Please enter test values (1111 - 6666): "; cin >> input; MastermindDigits testGame(input); playRound(testGame); break; } default: menuSel=0; } } while (menuSel!=0); return 0; } void playRound(MastermindDigits& game) { int tip; int won=0; int round=1; do { cout << endl << "Ihr Tip: "; cin >> tip; MastermindDigits user(tip); cout << "Position richtig: " << game.locationRight(user) << endl; cout << "Ansonsten richtig: " << game.locationWrong(user) << endl; if (game.locationRight(user)==4) { won=1; cout << endl << "Sie haben gewonnen!" << endl; system("pause"); } round++; } while ((won==0) && (round <= MAXROUND)); }