/***************************************************************/ /* Laboration 2 i C++ */ /***************************************************************/ /* Mastermind */ /* Crille & Robin 971009 */ /***************************************************************/ #include "lab_2.h" typedef int secret[ARRAY]; /***************************************************************/ /*SÄKER INMATNING */ /***************************************************************/ int mataIn() { char buffer[BUFFERSIZE]; int f; do { cin >> buffer; if (strcmp(buffer,"0") == 0) return 0; else { f = atoi(buffer); if (f!=0) return f; else cout <<"Inget tal, försök igen: "; } }while (!f); } /***************************************************************/ /*GENERERAR EN hemligt_tal - VEKTOR */ /***************************************************************/ void hemligt(secret &tal) { int i,j,slumpat_tal,size=10; int slump[] = {0,1,2,3,4,5,6,7,8,9}; srand(time(NULL)); for (i=0; i= TRIES) fel(hemligt_tal); else klar(a); cout <<"\nVill du spela en omgång till\ [J/N]:"; cin >> replay; if (replay == 'n') omstart=0; } }