Thursday, December 23, 2010
C++
cari nilai max & min
#include <iostream.h>
#include <conio.h>
int max(int, int );
int max(int, int, int);
int doble (double, double);
int fungsi1(int);
int fungsi2(int);
int fungsi1(int a){
int n;
n=10;
cout << n << endl ;
return 0;
}
int fungsi2(int b){
return b;
}
int max(int x, int y){
int m=(x>y?x:y);
cout<<m<<endl;
return 0;
}
int max(int x, int y, int z){
int m = ( x > y? x:y);
return(z>m?z:m);
}
int dobel(double x, double y){
return (x > y ? x : y);
}
int main ()
{
fungsi1(25);
cout << fungsi2(20) <<endl;
cout << "maksimum antara 35 dan 12 adalah : ";
max(35, 12);
cout << "maksimum antara 33, 73, dan 52 adalah : ";
cout << max(33, 73, 52) << endl;
cout<< "maksimum antara 51.4 dan 12.7 adalah : ";
cout << dobel(51.4, 12.7) << endl;
getch ();
return 0;
}
0 Response to " cari nilai max & min "
Post a Comment