Эта программа «FindMIn» принимает два значения в качестве параметров и возвращает наименьшее значение. Я пытаюсь изменить свою программу, так что она принимает три значения в качестве параметров и возвращает наименьшее из трех значений. Это то, что у меня есть до сих пор Но как?пытается скомпилировать мою программу на C++.
#include <iostream>
using namespace std;
//function prototypes go before main - parameters much match those of the function definition
int FindMin(int x, int y);
//place prototype for PrintOutput here
int main()
{
int n1, n2, n3;
int result;
char answ = 'Y';
while (answ == 'Y')
{
cout << "Please enter three numbers..." << endl;
cin >> n1 >> n2 >> n3;
result = FindMin(n1, n2); //function call
//place call to function PrintOutput here
cout << "Would you like to run the program again? Enter Y or N" << endl;
cin >> answ;
}
return(0);
}
//***************************************************************
//FindMin - returns the minimum of two values
//***************************************************************
int FindMin(int a, int b)
{
if (a < b)
return a;
else
return b;
}
//******************************************************************
//PrintOutput - prints the values input and the smallest of the
//three values
//******************************************************************
void PrintOutput(int first, int second, int min)
{
cout << "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" << endl;
cout << "The minimum value of " << first << ", " <<
second << ", is " << min << endl;
cout << "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" << endl;
}
как _what_ ... –
-1: Нет конкретного вопроса, так далеко. –
что именно ваш вопрос? – David