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?

I'm trying to prompt the program to "drop a single chip". I

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; cout

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!