subject

Subtraction + Decision and Loop This is a twist on the previous exercise that will help you review loops and decision structures. You will again ask the user to enter two numbers. However, you will ALWAYS subtract the smaller number from the larger number to ensure that you never get a negative number for an answer. You do this by checking the numbers and switching them if they are not in the right order (larger then smaller). All of this checking, switching, subtracting, and output of the answer should occur in a function.
((( THIS WAS THE PREVIOUS EXERCISE
Function Basics - Arguments and Parameters
This is another easy exercise to test your knowledge of the fundamentals. In main(), ask the user to enter two integers. Pass those two integers to a function that will subtract one number from another. This function must also output the answer to the user.
Output:
Enter two integers (separated by a space) and this program will subtract them: [user enters: 5 7]
5 - 7 = -2
Notes and Hints:
1) From now on, you must use a function prototype for all programs that use functions. Don't expect me to ask for it in each exercise. )))
Finally, ask the user if they would like to run the program again. By now, you should know exactly what type of loop to use.
Output:
Enter two integers (separated by a space) and this program will subtract the smaller from the larger: [user enters: 7 5]
7 - 5 = 2
Do you want to run this program again? [user enters: y]
Enter two integers (separated by a space) and this program will subtract the smaller from the larger: [user enters: 5 7]
7 - 5 = 2
Do you want to run this program again? [user enters: n]
Notes and Hints:
1) As always, make sure you accept an upper or lower case 'Y'

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 03:30
Jessie has received a contract to build a real-time application for a baker. however, the baker doesn't want to invest too much money. his only requirement is that he wants the customers to know which cupcakes are available at what time and in what quantity. so his core requirement is that the details of product should be in real time. what platform can jessie use to develop this application?
Answers: 1
question
Computers and Technology, 22.06.2019 05:00
Which two editions of windows 7 support 64 bit cpus? choose two out of professional, business, starter, or home premium.
Answers: 1
question
Computers and Technology, 22.06.2019 19:20
1)consider the following code snippet: #ifndef book_h#define book_hconst double max_cost = 1000.0; class book{public: book(); book(double new_cost); void set_cost(double new_cost); double get_cost() const; private: double cost; }; double calculate_terms(book bk); #endifwhich of the following is correct? a)the header file is correct as given.b)the definition of max_cost should be removed since header files should not contain constants.c)the definition of book should be removed since header files should not contain class definitions.d)the body of the calculate_terms function should be added to the header file.
Answers: 1
question
Computers and Technology, 24.06.2019 01:30
How can you make your column headings stand out?
Answers: 1
You know the right answer?
Subtraction + Decision and Loop This is a twist on the previous exercise that will help you review...
Questions
question
Mathematics, 26.10.2021 01:10
question
Mathematics, 26.10.2021 01:10
Questions on the website: 13722360