Program Menentukan Nama Hari Dengan C++
#include<iostream.h>
#include<conio.h>
main ()
{
char koha;
cout<<"\n \t MENENTUKAN NAMA HARI \n"<<endl;
cout<<" A = SENIN C = RABU E = JUM'AT G = MINGGU "<<endl;
cout<<" B = SELASA D = KAMIS F = SABTU "<<endl;
cout<<" \n Masukkan Kode Hari (A..G): ";
cin>>koha;
cout<<endl;
switch (koha)
{
case 'A' :
cout<<" \t Hari Senin "<<endl;
break;
case 'B' :
cout<<" \t Hari Selasa"<<endl;
break;
case 'C' :
cout<<" \t Hari Rabu "<<endl;
break;
case 'D' :
cout<<" \t Hari Kamis "<<endl;
break;
case 'E' :
cout<<" \t Hari Jum'at "<<endl;
break;
case 'F' :
cout<<" \t Hari Sabtu "<<endl;
break;
case 'G' :
cout<<" \t Hari Minggu "<<endl;
break;
default:
cout<<" \n \t Anda salah Input "<<endl;
}
getch();
}
dan Seperti ini Tampilan Outputnya
#include<conio.h>
main ()
{
char koha;
cout<<"\n \t MENENTUKAN NAMA HARI \n"<<endl;
cout<<" A = SENIN C = RABU E = JUM'AT G = MINGGU "<<endl;
cout<<" B = SELASA D = KAMIS F = SABTU "<<endl;
cout<<" \n Masukkan Kode Hari (A..G): ";
cin>>koha;
cout<<endl;
switch (koha)
{
case 'A' :
cout<<" \t Hari Senin "<<endl;
break;
case 'B' :
cout<<" \t Hari Selasa"<<endl;
break;
case 'C' :
cout<<" \t Hari Rabu "<<endl;
break;
case 'D' :
cout<<" \t Hari Kamis "<<endl;
break;
case 'E' :
cout<<" \t Hari Jum'at "<<endl;
break;
case 'F' :
cout<<" \t Hari Sabtu "<<endl;
break;
case 'G' :
cout<<" \t Hari Minggu "<<endl;
break;
default:
cout<<" \n \t Anda salah Input "<<endl;
}
getch();
}
dan Seperti ini Tampilan Outputnya
ConversionConversion EmoticonEmoticon