Listing Program :
# include
# include
void main()
{
char KP[6], buatan[20],processor[20];
cout<<"masukkan kode produk barang (A,J,K,C,G,T),(3,4,5) : ";
cin>>KP;
switch (KP[0]){
case 'A' : strcpy (buatan,"Amerika"); break;
case 'J' : strcpy (buatan,"Jepang"); break;
case 'K' : strcpy (buatan,"Korea"); break;
case 'C' : strcpy (buatan,"China"); break;
case 'G' : strcpy (buatan,"German"); break;
case 'T' : strcpy (buatan,"Taiwan"); break;
default : strcpy (buatan,"tidak diketahui");
}
switch (KP[1]){
case '3' : strcpy (processor,"Intel 386 MHZ"); break;
case '4' : strcpy (processor,"Intel 486 MHZ"); break;
case '5' : strcpy (processor,"Intel pentium"); break;
default : strcpy (processor,"salah input");
}
cout << "Spesifikasi Komputer : \n";
cout << "\tBuatan\t\t: " << buatan << endl;
cout << "\tProsesor\t: " << processor << endl;
cout << "\tHarddisk\t: " << KP[2] << KP[3] << KP[4] << " Gigabyte";
}
# include
void main()
{
char KP[6], buatan[20],processor[20];
cout<<"masukkan kode produk barang (A,J,K,C,G,T),(3,4,5) : ";
cin>>KP;
switch (KP[0]){
case 'A' : strcpy (buatan,"Amerika"); break;
case 'J' : strcpy (buatan,"Jepang"); break;
case 'K' : strcpy (buatan,"Korea"); break;
case 'C' : strcpy (buatan,"China"); break;
case 'G' : strcpy (buatan,"German"); break;
case 'T' : strcpy (buatan,"Taiwan"); break;
default : strcpy (buatan,"tidak diketahui");
}
switch (KP[1]){
case '3' : strcpy (processor,"Intel 386 MHZ"); break;
case '4' : strcpy (processor,"Intel 486 MHZ"); break;
case '5' : strcpy (processor,"Intel pentium"); break;
default : strcpy (processor,"salah input");
}
cout << "Spesifikasi Komputer : \n";
cout << "\tBuatan\t\t: " << buatan << endl;
cout << "\tProsesor\t: " << processor << endl;
cout << "\tHarddisk\t: " << KP[2] << KP[3] << KP[4] << " Gigabyte";
}
Tidak ada komentar:
Posting Komentar