Question

/* This while loop continues to execute until the user chooses valid no. of minute*/ while (true) 56 57 58 59 /getting the input entered by the user cout << Enter no. of minute cin > minutes; if (minutes >= 88 minutes <= 44640) 61 break 64 65 else 67 68 << endl; cout <<-.. Invalid· Must be between 0-44640 continue 70 71 72 73 74 75 76 //Based on the user choice the corresponding cose will be executed switch (choice) case A //calculating the bill due if(minutes 100) 78 79 80 81 82 83 amountDue- 10; else amountDue 10 (minutes 100) 0.25; cout << The amount due for the month is $ <s amountDue< endl; 85 86 87 break; case B: 89 90 91 calculating the bil1 due if(minutes >= 0 && minutes <= 250)
media%2Ff6f%2Ff6f4608d-7928-463c-89e6-85
media%2Fa17%2Fa174d9d8-b568-4bfe-8fcd-a3
Help! How do I fix these errors?
0 0
Add a comment Improve this question Transcribed image text
Answer #1

In CPP switch case syntax shown below :

switch(expression) {
   case constant-expression  :
      statement(s);
      break; //optional
   case constant-expression  :
      statement(s);
      break; //optional
  
   // you can have any number of case statements.
   default : //Optional
      statement(s);
}

As per above syntax ,in your code take at line 71 there is no statemnet " switch(expression) " .Before this statement write a statement to take input value expression from standard input (A,B,C,D ) .

Correct Code fragment : place at line 71

cout<<"Enter case value";

cin >> expression;

switch (expression)

{

Add a comment
Know the answer?
Add Answer to:
Help! How do I fix these errors? /* This while loop continues to execute until the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • c++, I am having trouble getting my program to compile, any help would be appreciated. #include...

    c++, I am having trouble getting my program to compile, any help would be appreciated. #include <iostream> #include <string> #include <string.h> #include <fstream> #include <stdlib.h> using namespace std; struct record { char artist[50]; char title[50]; char year[50]; }; class CD { //private members declared private: string artist; //asks for string string title; // asks for string int yearReleased; //asks for integer //public members declared public: CD(); CD(string,string,int); void setArtist(string); void setTitle(string); void setYearReleased(int); string getArtist() const; string getTitle() const; int...

  • below i added the code, but while running it, makefile.win error showing. how i fix this?...

    below i added the code, but while running it, makefile.win error showing. how i fix this? 1.)waitlist.h #include<iostream> using namespace std; class guest{    public:    string name;    guest*next;    guest*prev;    guest(string);    }; class waitList{    int numberOfGuests;    guest* first;    guest* last;    public:        waitList();        void addPerson(string);        void deletePerson(string);        guest* getFirst();        guest* getLast();    }; 2.)waitlist.cpp #include<iostream> #include"waitlist.h" using namespace std; guest::guest(string name){    this->name...

  • Hi there! I need to fix the errors that this code is giving me and also...

    Hi there! I need to fix the errors that this code is giving me and also I neet to make it look better. thank you! #include <iostream> #include <windows.h> #include <ctime> #include <cstdio> #include <fstream> // file stream #include <string> #include <cstring> using namespace std; const int N=10000; int *freq =new int [N]; int *duration=new int [N]; char const*filename="filename.txt"; int songLength(140); char MENU(); // SHOWS USER CHOICE void execute(const char command); void About(); void Save( int freq[],int duration[],int songLength); void...

  • I need help with this code. I'm using C++ and Myprogramming lab to execute it. 11.7:...

    I need help with this code. I'm using C++ and Myprogramming lab to execute it. 11.7: Customer Accounts Write a program that uses a structure to store the following data about a customer account:      Customer name      Customer address      City      State      ZIP code      Telephone      Account balance      Date of last payment The program should use an array of at least 20 structures. It should let the user enter data into the array, change the contents of any element, and display all the...

  • Write a do-while loop that continues to prompt a user to enter a number less than...

    Write a do-while loop that continues to prompt a user to enter a number less than 100, until the entered number is actually less than 100. End each prompt with a newline. Ex: For the user input 123, 395, 25, the expected output is: Enter a number (<100): Enter a number (<100): Enter a number (<100): Your number < 100 is: 25 c++ #include using namespace std; int main() { int userInput = 0; do cout << "Your number <...

  • C++ Program Write a do-while loop that continues to prompt a user to enter a number...

    C++ Program Write a do-while loop that continues to prompt a user to enter a number less than 100, until the entered number is actually less than 100. End each prompt with a newline. Ex: For the user input 123, 395, 25, the expected output is: Enter a number (<100): Enter a number (<100): Enter a number (<100): Your number < 100 is: 25 #include <iostream> using namespace std; int main() { int userInput; /* Your solution goes here */...

  • C++ programming I need at least three test cases for the program and at least one...

    C++ programming I need at least three test cases for the program and at least one test has to pass #include <iostream> #include <string> #include <cmath> #include <iomanip> using namespace std; void temperatureCoverter(float cel){ float f = ((cel*9.0)/5.0)+32; cout <<cel<<"C is equivalent to "<<round(f)<<"F"<<endl; } void distanceConverter(float km){ float miles = km * 0.6; cout<<km<<" km is equivalent to "<<fixed<<setprecision(2)<<miles<<" miles"<<endl; } void weightConverter(float kg){ float pounds=kg*2.2; cout<<kg<<" kg is equivalent to "<<fixed<<setprecision(1)<<pounds<<" pounds"<<endl; } int main() { string country;...

  • C++ getline errors I am getting getline is undefined error messages. I would like the variables...

    C++ getline errors I am getting getline is undefined error messages. I would like the variables to remain as strings. Below is my code. #include <iostream> #include<string.h> using namespace std; int index = 0; // variable to hold how many customers are entered struct Address //Structure for the address. { int street; int city; int state; int zipcode; }; // Customer structure struct Customer { string firstNm, lastNm; Address busAddr, homeAddr; }; // Functions int displayMenu(); Customer getCustomer(); void showCustomer(Customer);...

  • IN C++ Help to fix code Library management program. Error is when i type a letter...

    IN C++ Help to fix code Library management program. Error is when i type a letter into options menu the code breaks. after your edits, the code should still run as normal. CODE: #include<iostream> using namespace std; //structure to store library data class BookDetails{ public: struct library { int code; char title[20]; int status; }; library book_details[100]; }; //structure to store user data class UserDetails:public BookDetails{ public: struct users { int id; char name[20]; int booksNumber; }; users user_details[100]; };...

  • I need help in my C++ code regarding outputting the enums in string chars. I created...

    I need help in my C++ code regarding outputting the enums in string chars. I created a switch statement for the enums in order to output words instead of their respective enumerated values, but an error came up regarding a "cout" operator on my "Type of Item" line in my ranged-based for loop near the bottom of the code. I tried casting "i.type" to both "i.GroceryItem::Section::type" and "i.Section::type", but neither worked. Simply put, if a user inputs 1 as their...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT