Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a C++ program that inputs two integers then calls a function subtract, use

ID: 3535621 • Letter: W

Question

Write a C++ program that inputs two integers then calls a function subtract, use pass by reference and allow the user to change his/her input values, then subtract the two numbers and return the difference.

Explanation / Answer

include using namespace std; // function prototypes go here int main() { // declare integers, may as well initialize them to 1, can't hurt // need to declare a variable for user input char cont = 'y'; while (cont == 'y') { // display current values of x, y to the user // ask them if they want to change the values // get input from the user while (input != 'y' && input != 'n') // your choice if you want to include this { // this basically clears incorrect input cin.clear(); cin.ignore(1000, ' '); cout > input; } if (input == 'y') { // user wants to change the values, prompt them to do so // call the function to change the values here while (cin.fail()) { cin.clear(); cin.ignore(1000, ' '); cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote