nested selection

event................. red house.............. blue house........... yellow house
Chess ......................12.................... 5....................................8
TableTennis .................. 4.......................... 11 .....................17
Basket Ball .................... 6......................... 5......................14
karathe ..........................5........................... 8.........................10


Write a program to input the house name, and the score (as shown in the table) of the sport
event obtained by the corresponding house. Then find the total score . You should use nested selection statements.

i) If the user inputs a wrong house name, display the error message "In valid House Name".

ii) Modify the program to handle many data. After calculate and disp ay the total score of the
house, the program should display a prompt "Do you need to enter nother house name?".
If the user inputs "y" or "Y", program should ask for the next house name and the scores.
If the user inputs "n" or "N" after entering all three houses, program should terminate by
printing the score of the winner.
If the user inputs "n" or "N" and without entering all three houses, program should display
an error message "Error in finding the winner" and terminate without printing the ranks.
Note: format the output into two decimal places.

Sample output:
Enter the house name: red house
Enter the score of Chess: 12
Enter the score of Table Tennis:4
Enter the score of Basket Ball:6
Enter the score of karathe 5
Score is: 27 Points
Do you enter another house name? y

Enter the house name: blue house
Enter the score of Chess:5
Enter the score of Table Tennis:ll
Enter the score of Basket Ball:5
Enter the score of karathe 8
Score is: 29 Points
Do you enter another house name? y

Enter the house name: yellow house
Enter the score of Chess:8
Enter the score of Table Tennis: 17
Enter the score of Basket Ball: 14
Enter the score of karathe 10
Score is: 49 Points
Do you enter another house name? n
The winner scored: 49 Points
Last edited on
What do you have so far? If you post your code and where you're running into trouble, someone here can help.

Use the code tag ( <> in the format palette on the right side) around your code to make it easier for others to read.
its a table
Last edited on
OK, but please post the C++ program you've written so far for your homework and let us know where you are stuck.
Topic archived. No new replies allowed.