contoh program case c++
#include <iostream.h>
int main()
{
unsigned short int number;
cout << "masukan hari 1-7: ";
cin >> number;
switch (number)
{
case 0: cout << "gak ada hari ke 0 sob!!";
break;
case 1: cout << "hari senin\n";
break;
case 2: cout << "hari selasa\n";
break;
case 3: cout << "hari rabu\n";
break;
case 4: cout << "hari kamis\n";
break;
case 5: cout << "hari jumat\n";
break;
case 6: cout << "hari sabtu\n";
break;
case 7: cout << "hari Minggu\n";
break;
default: cout << "Aduh kegedean\n";
break;
}
cout << "\n\n";
return 0;
}
0 komentar:
Post a Comment