Friday, June 17, 2016

Program sederhana dengan perintah switch di dev c++

·       
  •            PROGRAM DENGAN PERINTAH SWITCH

// Taufik Hendriyanto
#include<iostream>
using namespace std;
main()
{
int mobil;
cout<<"KODE MERK MOBIL"<<endl;
cout<<""<<endl;
cout<<"1 = TOYOTA"<<endl;
cout<<"2 = NISSAN"<<endl;
cout<<"3 = DAIHATSU"<<endl;
cout<<"4 = HONDA"<<endl;
cout<<"5 = ALPARD"<<endl;
cout<<""<<endl;
                cout<<"Masukan Kode Mobil: "<<endl;
                cin>>mobil;
                switch(mobil)
{
                case 1:
                cout<<"TOYOTA"<<endl;
                break;
                case 2:
                cout<<"NISSAN"<<endl;
                break;
                case 3:
                cout<<"DAIHATSU"<<endl;
                break;
                case 4:
                cout<<"HONDA"<<endl;
                break;
                case 5:
                cout<<"ALPARD"<<endl;
                break;
                default :
                cout<<"TIDAK ADA"<<endl;
}
return 0;
}

  •   ALGORITMA


{Mencetak merk mobil sesuai dengan kode yang tertulis (1-5)}

  • FLOWCHART

0 comments:

Post a Comment