#include<iostream.h>
#include<iomanip.h>
using namespace std;
float number1, number2, number3;
void readThreeNumbers(number1, number2, number3);
void sortThreeNumbers(number1, number2, number3);
void displayNumbers(number1, number2, number3);
int main ()
{
readThreeNumbers(number1, number2, number3);
sortThreeNumbers(number1, number2, number3);
displayNumbers(number1, number2, number3);
}
void readThreeNumbers(number1, number2, number3)
{
cout << "Please enter three floating-point numbers, space between them: ";
cin >> number1 >> number2 >> number3;
}
void sortThreeNumbers(number1, number2, number3)
{
if (number1 > number2)
{
temp = number1
number1 = number2
number2 = temp
}
if (number2 > number3)
{
temp = number2
number2 = number3
number3 = temp
}
if (number1 > number2)
{
temp = number1
number1 = number2
number2 = temp
}
}
void displayNumbers(number1, number2, number3)
{
cout << setiosflags(ios::fixed | ios::showpoint) << setprecision(2);
cout << "The average of " << number1 << "," << number2 << " and " << number3 << " is " << ;
system("pause");
}
i have this code that which inputs three number sort the three numbers in
ascending order then output the three numbers.
i'm getting this list of errors but i don't know how fix it.
In function `int main()':
`readThreeNumbers' cannot be used as a function
`sortThreeNumbers' cannot be used as a function
`displayNumbers' cannot be used as a function
At global scope:
`readThreeNumbers' declared void
`int readThreeNumbers'
`int readThreeNumbers' previously declared here
expected `,' or `;' before '{' token
`sortThreeNumbers' declared void
redefinition of `int sortThreeNumbers'
`int sortThreeNumbers' previously declared here
expected `,' or `;' before '{' token
`displayNumbers' declared void
redefinition of `int displayNumbers'
`int displayNumbers' previously declared here
expected `,' or `;' before '{' token