Question: Rewrite this program using nested if-else statements #include using namespace std; /* Estimates dog's age in equivalent human years. Source: www.dogyears.com */ int main() {

Rewrite this program using nested if-else statements

#include using namespace std;

/* Estimates dog's age in equivalent human years. Source: www.dogyears.com */

int main() { int dogAgeYears;

cout << "Enter dog's age (in years): " << endl; cin >> dogAgeYears;

switch (dogAgeYears) { case 0: cout << "That's 0..14 human years." << endl; break;

case 1: cout << "That's 15 human years." << endl; break;

case 2: cout << "That's 24 human years." << endl; break;

case 3: cout << "That's 28 human years." << endl; break;

case 4: cout << "That's 32 human years." << endl; break;

case 5: cout << "That's 37 human years." << endl; break;

default: cout << "Human years unknown." << endl; break; }

return 0; }

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!