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

This is my problem: Write a program that prompts the user to input three integer

ID: 3627138 • Letter: T

Question

This is my problem:
Write a program that prompts the user to input three integers. You may assume that none of the integers are equal. The output of the program should print the numbers in order from largest to smallest. Use value-returning functions to determine which number is largest, smallest and in the middle. Remember that value-returning functions should not have cin or cout statements. Don’t forget to put the <your name> statement in your program.

Here is how much I have done:
#include <iostream>
#include <conio.h>

using namespace std;

int FindLargeNumber(int, int, int, int);
int FindMiddleNumber(int, int, int, int);
int FindSmallNumber(int, int, int, int);
int main()
{
int num;
int a;
int b;
int c;
int largest;
int middle;
int smallest;
int numberOrder;
int big;
int medium;
int little;

cout << "Enter the first number: " << endl;
cin >> a;
cout << "Enter the second number: " << endl;
cin >> b;
cout << "Enter the third number: " << endl;
cin >> c;

largest = FindLargeNumber(a, b, c, big);
middle = FindMiddleNumber(a, b, c, medium);
smallest = FindSmallNumber(a, b, c, little);

cout << "These are the numbers you entered in order from largest to smallest"
<< largest << middle << smallest << endl;

getch();
return 0;
}

int FindLargeNumber(int a, int b, int c, int big)
{
if((a > b)||(a > c))
big = a;
return big;

if ((b > a) || (b > c))
big = b;
return big;

if((c > a) || (c > b))
big = c;
return big;
}

int FindMiddleNumber(int a, int b, int c, int medium)
{
if(a > b)
if(a < c)
return medium;
if(b > a)
if(b > c)
medium = b;
return medium;
if(c > a)
if(c > b)
medium = c;
return medium;
}

int FindSmallNumber(int a, int b, int c, int little)
{
if(b > a)
if(b > c)
little = b;
return little;
if(c > a)
if(c > b)
little = c;
return little;
}

I dont know what else to do...

Explanation / Answer



#include <iostream>
#incldue<conio.h>
// for sorting no need to write big program like this

// any way i modified your code for you :)
using namespace std;

int FindLargeNumber(int&,int&, int&, int&);
int FindMiddleNumber(int&,int&, int&, int&);
int FindSmallNumber(int&,int&, int&, int&);
int main()
{
int num,a,b,c;
int largest,middle,smallest,numberOrder,big,medium,little;

cout << "Enter the first number: " << endl;
cin >> a;
cout << "Enter the second number: " << endl;
cin >> b;
cout << "Enter the third number: " << endl;
cin >> c;

largest = FindLargeNumber(a, b, c, big);
middle = FindMiddleNumber(a, b, c, medium);
smallest = FindSmallNumber(a, b, c, little);

cout << "These are the numbers you entered in order from largest to smallest"
<< largest << middle << smallest << endl;
getch();
return 0;
}

int FindLargeNumber(int& a, int& b, int& c, int& big)
{
if(a>b) big = a;
else big = b;
if(big < c) big = c;

return big;
}

int FindMiddleNumber(int& a, int& b, int& c, int& medium)
{
if(a<b) little = a;
else little = b;
if(c < little ) little = c;

if(a>b) big = a;
else big = b;
if(big < c) big = c;
medium = (a+b+c) -(big+little);
return medium;

}

int FindSmallNumber(int& a, int& b, int& c, int& little)
{
if(a<b) little = a;
else little = b;
if(c < little ) little = c;
return little;
}

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