Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Program 4 Use filename Week10YourNameProg4Price Convert the following program into a switch statement version and run the program yes it can be done..Look at

C++

Program 4 Use filename Week10YourNameProg4Price Convert the following program into a switch statement version and run the program yes it can be done..Look at code example 4 above. Which version do you think is easier to understand, the if or the switch ? #include using namespace std; int main() { int age = 0; cout << "Enter age to see ticket price: "; cin >> age; if (age <= 5) { cout << "$0.00" << endl << endl; } else if (age >= 6 && age <= 12) { cout << "$10.00" << endl; } else if (age >= 13 && age <= 26) { cout << "$18.00" << endl; } else { cout << "$15.00" << endl; } system("PAUSE"); // PC only return 0; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Accidental Data Scientist

Authors: Amy Affelt

1st Edition

1573877077, 9781573877077

More Books

Students also viewed these Databases questions