Program c++ memasukkan kode hari dengan case

February 5, 2011

#include<iostream.h>
void main()
{
int kodehari;
cout<<“masukkan kode hari=”;
cin>>kodehari;

switch(kodehari)
{
case 1 :
cout<<“senin”;
break;
case 2 :
cout<<“selasa”;
break;
case 3 :
cout<<“rabu”;
break;
case 4 :
cout<<“kamis”;
break;
case 5 :
cout<<“jumat”;
break;
case 6 :
cout<<“sabtu”;
break;
case 7 :
cout<<“minggu”;
break;
default:
cout<<“kodehari salah” ;
break;
}
}