C++ Pengurutan dengan IF

#include<iostream>
#include<conio.h>
 int main (){
  int a,b,c;
  cout<<" Program Menguutkan Angka dari Tekecil ke Terbesar"<<endl;
  cout<<" "<<endl;
  cout<<" Masukan nilai ke-1 : ";
  cin>>a;
  cout<<" Masukan nilai ke-2 : ";
  cin>>b;
  cout<<" Masukan nilai ke-3 : ";
  cin>>c;
  cout<<" "<<endl;
  cout<<" Nilai sesudah di masukan"<<endl;
  if((a>b)&&(b>c))cout<< c <<","<< b <<","<< a << endl;
   if((a<b)&&(b<c))cout<< a <<","<< b <<","<< c << endl;
   if((b>a)&&(a>c))cout<< c <<","<< a <<","<< b << endl;
   if((b<a)&&(a<c))cout<< b <<","<< a <<","<< c << endl;
   if((c>a)&&(a>b))cout<< b <<","<< a <<","<< c << endl;
getch();
}

0 Response to "C++ Pengurutan dengan IF"

Posting Komentar