My friend and I made a small bet of who could do a program. I have no clue how to complete this, please help!
Haverly’s Needs a program to calculate the area of a room depending on the shape of the room. The Program should output a menu asking the shape of the room as follows:
Haverly’s
Room
Calculator:
************************
1.Square Room
2. Rectangular Room
3. Round Room
4. Quit Please enter a menu item(1-4)
>
If the user enters a 1, then the program should ask the user the
Width of the room. If the user enters a 2, then the program should ask for the length and the width of the room. If the user enters a 3, the program should ask for the radius. Use the following formulas:
Area of a rectangle or square:
Area = length*width;
Area of circle
(r = radius):
Area =3.14*r^2
If the user enters a 4, the program should output a
Message saying,
“Thank You for using Haverly’s Room Calculator...” And exit the program.
Input Validation: The Program must check to see if the user enters a valid number, i.e. 1 Through 4, When selecting an item from the menu. If The user does not enter a valid menu item, display an error message and exit the program. For length, width or radius the program should not accept any values less than or equal to zero. If An invalid value is entered, display an error message and exit the program.
@boost lexical cast
It is advisable that you refrain from using uniform initialization especially when you want to help others. Some people may not have a C++ compiler that supports C++11 features. They can either say it does not compile or it does not work (they are both the same).
Edit : There are also a number of problems in your code.