Problem

If you run Listing GuessBirthday.cpp with input Y for Set1, Set3, and Set4 and N for Set2...

If you run Listing GuessBirthday.cpp with input Y for Set1, Set3, and Set4 and N for Set2 and Set5, what will be the birthday?

Listing

1 #include 2 using namespace std ;34 int main()5 {6 int day = 0; // Day to be determined day to be determined7 char answer;89 // Prompt the user for Set110 cout << "Is your birthday in Set1? " << endl;11 cout << " 1 3 5 7\n" <<12 " 9 11 13 15\n" <<13 "17 19 21 23\n" <<14 "25 27 29 31" << endl;15 cout << "Enter N/n for No and Y/y for Yes : ";16 cin >> answer;1718 if (answer == 'Y' || answer == 'y')    in Set1?19 day += 1;2021 // Prompt the user for Set222 cout << "\nIs your birthday in Set2 ?" << endl;23 cout << " 2 3 6 7\n" <<24 "10 11 14 15\n" <<25 "18 19 22 23\n" <<26 "26 27 30 31" << endl;27 cout << "Enter N/n for No and Y/y for Yes : ";28 cin >> answer;2930 if (answer == 'Y' || answer == 'y')  in Set2?31 day += 2;3233 // Prompt the user for Set334 cout << "\n Is your birthday in Set3 ?" << endl;35 cout << " 4 5 6 7\n" <<36 "12 13 14 15\n" <<37 "20 21 22 23\n" <<38 "28 29 30 31" << endl;39 cout << "Enter N/n for No and Y/y for Yes : ";40 cin >> answer;4142 if (answer == 'Y' || answer == 'y')   in Set3?43 day += 4;4445 // Prompt the user for Set446 cout << "\n Is your birthday in Set4? " << endl;47 cout << " 8 9 10 11\n" <<48 "12 13 14 15\n" <<49 "24 25 26 27\n" <<50 "28 29 30 31" << endl;51 cout << "Enter N/n for No and Y/y for Yes: ";52 cin >> answer;5354 if (answer == 'Y' || answer == 'y')   in Set455 day += 8;5657 // Prompt the user for Set558 cout << "\n Is your birthday in Set5? " << endl;59 cout << "16 17 18 19\n" <<60 "20 21 22 23\n" <<61 "24 25 26 27\n" <<62 "28 29 30 31" << endl;63 cout << "Enter N/n for No and Y/y for Yes : ";64 cin >> answer;6566 if (answer == 'Y' || answer == 'y')67 day += 16;6869 cout << "Your birthday is " << day << endl;7071 return 0 ;72 }

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
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