Thank you for taking the time to review this questions, the task is to write an roulette game for class. but in order for this to work and do and while loop has to be configured for the age and the bet.
I am recieving at the moment a expected while in do/while loop error, but i cannot manage to figure it out.
Here is my code:
#include <iostream>
using namespace std;
int main(){
bool error = true;
string namn;
int insatsen;
int alder;
int amount = 1000;
int insats = 100;
int insats2 = 300;
int insats3 = 600;
while(error) {
cout << "hej och välkommen till His roulette" << endl;
cout << "vad är ditt namn?" << endl;
cin >> namn;
cout << "välkommen \n" << namn << endl;
do{
cout << "hur gammal är du?" << namn << endl;
cin >> alder;
if (alder >= 18) {
cout <<"tack så mycket" << namn << endl;
error = false;
continue;
}
else{
cout << "du är för ung för detta spel";
error = true;
}
}
do{
while(error){
cout << "Hur mycket vill du satsa?" << endl;
cin >> insatsen;
if (insatsen != insats && insatsen != insats2 && insatsen != insats3){
cout << "Vänligen välj en korrekt insats\n";
error = true;
}
else {
cout << "tack för din insats\n";
error = false;
continue;
}
}
}
}
}