Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- char name[20];
- float height = 0;
- float width = 0;
- float length = 0;
- float paint = 0;
- // Ask the user for their name
- cout << "Hello user, please enter your first name: ";
- cin >> name;
- cout << "I got " << name << "." << endl;
- // Ask user for the deminsions
- do
- {
- cout << "Okay " << name << ", please enter the length of the house:";
- cin >> length;
- if (length < 0)
- cout << "That input is invalid. Please enter a positive number, " << name << ".";
- } while (length < 0);
- do
- {
- cout << "I got the lenth " << name << ", now enter the width of the house: ";
- cin >> width;
- if (width < 0)
- cout << "That input is invalid. Please enter a positive number, " << name << ".";
- } while (width < 0);
- do
- {
- cout << "I got the width, now enter the height of the house, " << name << ":";
- cin >> height;
- if (height < 0)
- cout << "That input is invalid. Please enter a positive number, " << name << ".";
- } while (height < 0);
- do
- {
- cout << "Lastly, " << name << ", please enter the amount of coats youd like to apply on the house:";
- cin >> paint;
- if (paint < 0)
- cout << "That input is invalid. Please enter a positive number, " << name << ".";
- } while (paint < 0);
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement