Repeating
Hello peoples,
I'm making a little project for my Grade 10 programming class and I need help with repeating a part.
1 2 3 4 5 6 7 8 9 10
|
else if (choice1 == 2){
cout << "WOW! Back off buddy..." << endl;
cout << "Take it all! Take what you want!" << endl;
cout << "You: $";
cin >> steal;
if (steal > 100){
cout << "The register only has $100 inside! Hurry up!" << endl;
}
cout << setprecision (4) << steal << "!?! Fine take it!!" << endl;
cout << "You've collected $" << (loot = steal+money) << endl;
|
How can I make the bold repeat the entire origional if statement when the user gets it right?
Thanks in advance,
Tasty tasty Waffles
Just make a do while loop where the cond is steal > 100. Something like:
1 2 3 4 5 6 7
|
do {
cout << "You: $";
cin >> steal;
if (steal > 100){
cout << "The register only has $100 inside! Hurry up!" << endl;
}
} while(steal > 100);
|
Aaaah, thank you! This was confuzing me for a while
Topic archived. No new replies allowed.