Question
I'm trying to prompt the program to drop a single chip. I get to the SingleDrop function and then it calls the SlotCheck function. When
I'm trying to prompt the program to "drop a single chip". I get to the "SingleDrop" function and then it calls the "SlotCheck" function. When I get to the "SlotCheck" function, nothing goes right. When I put in a valid slot number 0-8, the "SingleDrop" function repeats continuosly. When I put in an invalid slot number, I get this error pictured below...
How do I fix these problems?
this is my code:
#include
#include
#include
#include
using namespace std;
string Menu(string userSelect) {
cout
cout
cout
cout
cout
cout
cin >> userSelect;
cout
return userSelect;
}
string EnterSelection(string userSelect) {
cout
cin >> userSelect;
return userSelect;
}
int SlotCheck(int numSlot) {
cin >> numSlot;
if (numSlot 8)
{
cout
string userSelect = EnterSelection(userSelect);
}
else {
cout
}
return numSlot;
}
void SingleDrop() {
cout
cout
int numSlot = 9;
numSlot = SlotCheck(numSlot);
}
int main()
{
string userSelect = " ";
int numSlot = 0;
cout
cin >> userSelect;
do {
while (userSelect != "1" && userSelect != "2" && userSelect != "3" && userSelect != "4") {
cout
cout
cin >> userSelect;
cout
}
if (userSelect == "1") {
SingleDrop();
}
if (userSelect == "2") {
//ADD CODE LATER
}
if (userSelect == "3") {
userSelect = Menu(userSelect);
}
if (userSelect == "4") {
//ADD CODE LATER
}
} while (userSelect != "4");
return 0;
}
int SlotCheck(int numSlot) cin numSlot; coutStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started