CONTOH PROGRAM MENENTUKAN
NILAI PALING TINGGI A,B,ATAU C DALAM DEV C++
PROGRAMNYA
:
#include <cstdlib>
#include <iostream>
#include <iomanip>
using namespace std;
int main(int argc, char *argv[])
{
int
a,b,c;
system ("cls");
cout<<"masukkan nilai a=";cin>>a;
cout<<"masukkan nilai b=";cin>>b;
cout<<"masukkan nilai c=";cin>>c;
if
((a<b)&&(b<c))
{
cout<<"maka a,b,c" ;
}
else if ((a<c)&&(c<b))
{
cout<<"maka a,c,b" ;
}
else if((b<a)&&(a<c))
{
cout<<"maka
b,a,c"<<endl;
}
else if ((b<c)&&(c<a))
{
cout<<"maka b,c,a" ;
}
else if ((c<a)&&(a<b))
{
cout<<"maka c,a,b" ;
}
else if ((c<b)&&(b<a))
{
cout<<"maka c,b,a" ;
}
else
{
cout<<"data salah"<<endl ;
}
system("PAUSE");
return EXIT_SUCCESS;
}
// yogi.king.pratama@blogspot.com
HASIL COMPILE :
Tidak ada komentar:
Posting Komentar