Program c++ memasukkan kode hari dengan case

#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;
}
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: