Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6019623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:26:54+00:00 2026-05-23T03:26:54+00:00

I have been looking for quite some time for an answer to this, and

  • 0

I have been looking for quite some time for an answer to this, and I haven’t found one so i decided to ask. For some reason I’m getting an illegal case statement error. This is for my final project and my teacher can’t even find the error. It was working fine before, but after it put in something then took it out, the case statement stopped working…even though the code’s the same…

         do //start of do while loop
{
cout << "Welcome to the Sperry Store!" << '\n'; //greeting

cout << " " << '\n';
cout << "1-  Men's Authentic Original Seasonal Boat Shoe.. $79.99" << '\n';
cout << "2-  Men's Authentic Original Suede Boat Shoe..... $64.99" << '\n';
cout << "3-  Men's Mako 2-Eye Canoe Moc Boat Shoe......... $70.00" << '\n';
cout << "4-  Men's Charter 2-Eye.......................... $90.00" << '\n';
cout << "5-  Defender 2-Eye Boat Shoe..................... $65.00" << '\n';
cout << "6-  Men's Embroidered Mako Short................. $34.99" << '\n';   //user friendly menu
cout << "7-  Men's Figawi Jacket.......................... $99.99" << '\n';
cout << "8-  Men's Mako Pant.............................. $45.99" << '\n';
cout << "9-  Check Out " << '\n';
cout << "0- Start Over and Erase all current sales information. "  << '\n';


cout << " " << '\n';
cout << "Please select the item you're interested in." << '\n'; 
cout << setprecision (5) << "Your current total is: $" << total << '\n'; //displays running total 
cin >> x; //allows entered value to take user to disired case statement

switch (x) //creates switch for the case statements
{
case '1':
    cout << "How many pairs would you like?" << '\n';
    cin >> amount;

    sub_total1 = (amount * seasonal);
    total = sub_total1 + total;                                 //case statements for getting the mula

    cout << "Your current total is: $" << total << '\n';


    break; //break statemets required to end case

case '2':

    cout << "How many pairs would you like?" << '\n';
    cin >> amount;

    sub_total2 = (amount * original);
    total = sub_total2 + total;

    break;

    case '3':

    cout << "How many pairs would you like?" << '\n';
    cin >> amount;

    sub_total3 = (amount * canoe);
    total = sub_total3 + total;

    break;

    case '4':

    cout << "How many pairs would you like?" << '\n';
    cin >> amount;

    sub_total4 = (amount * charter);
    total = sub_total4 + total;

    break;

    case '5':

    cout << "How many pairs would you like?" << '\n';
    cin >> amount;

    sub_total5 = (amount * defender);
    total = sub_total5 + total;

    break;

    case '6':

    cout << "How many pairs would you like?" << '\n';
    cin >> amount;

    sub_total6 = (amount * embroidered);
    total = sub_total6 + total;

    break;

    case '7':

    cout << "How jackets would you like?" << '\n';
    cin >> amount;

    sub_total7 = (amount * figawi);
    total = sub_total7 + total;

    break;

    case '8':

    cout << "How many pairs would you like?" << '\n';
    cin >> amount;

    sub_total8 = (amount * mako_pant);
    total = sub_total8 + total;


    break;

case '9':  //check out case statement, lets the function end

    cout << "Welcome to the check out, please finalize your order." << '\n';
    tax = total * .0875; //calculate tax
    cout << setprecision (5) << "Your total plus tax is: $" << (total = total + tax) << '\n'; //display total + tax
    cout << "Would you like your order to be shipped? (Type 1 for yes and 2 for no)" << '\n'; //allows choice for shipping or not
    cin >> shipping;

    if (shipping == '1')  //adds a shipping charge                                                                     
    {
        cout << "There is a flat shipping rate of $9.99" << '\n';
        cout << setprecision (5) << "Your new total is: $" << (total + 9.99) << '\n';
        cout << "Would you like a Receipt? (Press 1 for yes and 2 for no)" << '\n';
        cin >> receipt;


        if (receipt == '1')
        {
            cout << "                 " << "Your Receipt" << '\n';
cout << "Men's Authentic Original Seasonal Boat Shoe.."<< sub_total1 <<'\n';
cout << "Men's Authentic Original Suede Boat Shoe....."<< sub_total2 <<'\n';
cout << "Men's Mako 2-Eye Canoe Moc Boat Shoe........."<< sub_total3 <<'\n';
cout << "Men's Charter 2-Eye.........................."<< sub_total4 <<'\n';  //receipit
cout << "Defender 2-Eye Boat Shoe....................."<< sub_total5 <<'\n';
cout << "Men's Embroidered Mako Short................."<< sub_total6 <<'\n'; 
cout << "Men's Figawi Jacket.........................."<< sub_total7 <<'\n';
cout << "Men's Mako Pant.............................."<< sub_total8 <<'\n';
    cout << "If you have any questions please call (781)-452-2079."<< '\n';
    cout << "Thank you for shopping at The Sperry Store!" << '\n';
        }
        if (receipt == '2')
        {
            cout << "If you have any questions please call (781)-452-2079."<< '\n';
            cout << "Thank you for shopping at The Sperry Store!" << '\n';
        }


    }
    if (shipping == '2') //checks out without shipping
    {
                    cout << "                 " << "Your Receipt" << '\n';
cout << "Men's Authentic Original Seasonal Boat Shoe.."<< sub_total1 <<'\n';
cout << "Men's Authentic Original Suede Boat Shoe....."<< sub_total2 <<'\n';
cout << "Men's Mako 2-Eye Canoe Moc Boat Shoe........."<< sub_total3 <<'\n';
cout << "Men's Charter 2-Eye.........................."<< sub_total4 <<'\n';  //receipit
cout << "Defender 2-Eye Boat Shoe....................."<< sub_total5 <<'\n';
cout << "Men's Embroidered Mako Short................."<< sub_total6 <<'\n'; 
cout << "Men's Figawi Jacket.........................."<< sub_total7 <<'\n';
cout << "Men's Mako Pant.............................."<< sub_total8 <<'\n';
    cout << "If you have any questions please call (781)-452-2079."<< '\n';
    cout << "Thank you for shopping at The Sperry Store!" << '\n';
        }
        if (receipt == '2')
        {
            cout << "If you have any questions please call (781)-452-2079."<< '\n';
            cout << "Thank you for shopping at The Sperry Store!" << '\n';
        }

        no_ship(); //declares function

    }

    break;

    case '0':  //restart order statement

    cout << "Are you sure you would like to erase all data (This choice is non-reversable)?" << '\n';
    cout << "Press 1 for yes and 2 for no" << '\n';
    cin >> erase;

    if (erase == '1') //erases the data
    {
        shipping = 0;
        erase = 0;
        amount = 0;
        total = 0;          
        tax = 0;
        x = 0;
        sub_total1 = 0;
        sub_total2 = 0;
        sub_total3 = 0;
        sub_total4 = 0;
        sub_total5 = 0;
        sub_total6 = 0;
        sub_total7 = 0;
        sub_total8 = 0;
    }
    if (erase == '2') //returns to menu
    {
        cout << setprecision (4) << "Your current total is: $ " << total << '\n';  //returns user to the menu without erasing order
    }

    break;

    system("command/ccls");


}



while (x != '9'); //end of while loop (when x does not = 9)


return 0;
}

void no_ship() // displays the no_ship function data
{
    cout << "Your item will be ready in 1-2 business days." << '\n';
    cout << "If you have any questions please call (781)-452-2079."<< '\n';
    cout << "Thank you for shopping at The Sperry Store!" << '\n';
}

I apologize for such a long code but I have no idea where the error is. Here is the error in the compiler:

Compiling...
final project.cpp
H:\Comp. Prog\final project.cpp(232) : error C2046: illegal case
Error executing cl.exe.
final project.exe - 1 error(s), 0 warning(s)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T03:26:55+00:00Added an answer on May 23, 2026 at 3:26 am

    You should really work on your indentation, as it improves readability for you and others. Your problem is that case '0': is outside of the switch statement (with proper indentation that would have jumped at you).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been looking at this error for quite some time, and can't seem
I've been looking for ways of solving this problem for quite some time now.
I've been looking around for this for quite some time and cannot seem to
I have been using PHP for quite some time now and was wondering what
I've been looking around for quite some time but I just can't find the
I've been looking for a software synthesizer in AS3 for quite some time now,
I have been searching around for a solution for quite some time, hoping someone
I've been looking quite some time today to gather GPS coordinates from a Windows
I have been working with managing agile teams for quite some time. Now I'm
Been using PHP for quite some time now and I was wondering what this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.