0% found this document useful (0 votes)
6 views2 pages

Homework 4 5 6

Uploaded by

Tell Under
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views2 pages

Homework 4 5 6

Uploaded by

Tell Under
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

4/

#include <iostream>
using namespace std;
int maximum (int x, int y)
{
int max = y;
if (max>x)
{
max = y;
}
else
{
max = x;
}
return max;
}
int maximum (int, int);
int main()
{
int a, b, c;
cin>>a>>b>>c;
if (maximum (a, b)>c)
{
cout<<"The largest number is: "<<maximum (a, b);
}
else
{
cout<<"The largest number is: "<<c;
}

return 0;
}
5/
#include <iostream>
using namespace std;
int maximum( int &a, int &b)
{
if (a>b)
{
a = a;
}
else
{
a = b;
}
return a;
}
int maximum (int &, int &);
int main() {
int c, d;
cin >>c>>d;
maximum(c, d);
cout << "The maximum number is: " << c << endl;

return 0;
}

6/
#include <iostream>
using namespace std;
int maximum (int x, int y, int z)
{
int max = y;
if (x>max)
{
max = x;
}
if (z>max )
{
max = z;
}

return max;
}
int minimum (int g, int h, int k)
{
int min = g;
if (h<min)
{
min = h;
}
if (k<min)
{
min = k;
}
return min;
}
int maximum (int, int, int);
int minimum (int, int, int);
int main()
{
int a, b, c;
cin>>a>>b>>c;
cout<<"Max is: "<<maximum (a, b, c)<<endl;
cout<<"Min is: "<<minimum (a, b, c);
return 0;
}

You might also like