Question
C++ PROGRAMMING. USE FUNCTION TO PROGRAM THE ASSIGNMENT Below program asks user for three integers and prints the smallest and largest of those three on
C++ PROGRAMMING. USE FUNCTION TO PROGRAM THE ASSIGNMENT
Below program asks user for three integers and prints the smallest and largest of those three on screen. Your task is to write the missing functions (largest() and smallest ()), which receive the user input as parameters and return the largest and smallest integers, respectively.
Incomplete program:
#include
using namespace std;
int largest(int first, int second, int third);
intsmallest(int first, int second, int third);
int main()
{
int number1, number2, number3, largestnumber,smallestnumber;
cout << "Input the first integer";
cin >> number1;
cout << "Input the second integer:";
cin >> number2;
cout << "Input the third integer:";
cin >> number3;
largestnumber = largest(number1, number2, number3);
smallestnumber =smallest(number1, number2, number3);
cout << "The largest number was " << largestnumber;
cout << " and the smallest " < Note! Write the missing functions. Example output: Input the first integer:7 Input the second integer:8 Input the third integer:20 The largest number was 20 and smallest 7.
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