Question: Here is the code for the switch statement I am making. It keeps giving me an error saying case label not within a switch statement.

Here is the code for the switch statement I am making. It keeps giving me an error saying "case label not within a switch statement.

#include

int main () { int selection; //is an initial value necessary?

printf("Options to select: "); printf("1. Display Balance "); printf("2. Withdraw Funds "); printf("3. Deposit Funds "); printf("4. Transfer Funds "); printf("5. Quit ");

// Prompt and read in user's selection printf("Enter your selection (1-5): "); scanf("%d", &selection);

// Continue processing based on user's selection

switch (selection); { case 1: printf("You selected 1, Display Balance. "); break; case 2: printf("You selected 2, Withdraw Funds. "); break; case 3: printf("You selected 3, Deposit Funds. "); break; case 4: printf("You selected 4, Transfer Funds. "); break; case 5: printf("You selected 5, Quit. "); break; default: printf("Sorry, you must select from 1-5. "); break; } }

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!