using namespace std;
double larger(double x,double y);
double compareThree(double x,double y,double z);
int main()
{
double one,two; //Line 1
cout<<" The larger of 5 and 10 is = "<<larger(5,10)<<endl; //Line 2
cout<<"Enter two numbers:"; //Line 3
cin>>one>>two; //Line 4
cout<<endl; //Line 5
cout<<"Line6:The larger of "<<one<<" and "<<two<<" is = "<<larger(one,two)<<endl; //Line 6
cout<<"Line7:The largest of 43.48, 34.00,"<<"and 12.65 is"<<compareThree(43.48,34.00,12.65)<<endl; //Line 7
return 0;
}
double larger(double x,double y)
{
double max;
if(x>=y)
max=x;
else
max=y;
return max;
}
double compareThree(double x,double y,double z)
{
return larger(x,larger(y,z));
}
No comments:
Post a Comment