Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Problem 1 (10 points) Write a complete C++ program that asks the user to enter their age and the number of pets that they have
Problem 1 (10 points) Write a complete C++ program that asks the user to enter their age and the number of pets that they have at home. A legal age must be between 1 and 100 (inclusive). If the user enters an illegal age the program should print I don't believe you! Otherwise if the number of pets is divisible by the age (without a remainder) the program should print That is a lot of pets. Here is a sample to show how the program runs. Enter the your age and number of pets: 20 200 That is a lot of pets. Problem 3 (10 points) Write a complete C++ program that repeatedly asks the user to enter a number of rows. If rows is greater than or equal to 0, the program prints a triangular pattern of *s with that number of rows. When a user enters a negative number of rows, the program tells the user the total number of *s that have been printed and terminates. Here is a sample to show how the program runs. Enter the number of rows or a negative number to stop: 4 ** *** ***** Enter the number of rows or a negative number to stop: 2 ** Enter the number of rows or a negative number to stop: 3 * *** Enter the number of rows or a negative number to stop: -1 A total of 19 *S were printed
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started