andRie's Blog

May 3, 2010

menentukan jumlah hari pada cpp

Filed under: cpp — andriedwicn @ 12:23 pm

//dibuat oleh: andrie dwi cahyo nugroho

#include <iostream.h>
#include <conio.h>
// menentukan jumlah hari
int main()
{
int kode_bulan;

cout<<“Masukkan kode bulan (1-12): “;
cin>>kode_bulan;

switch(kode_bulan)
{
case 2:
cout<<“Jumlah hari 28 atau 29\n”;
break;
case 1:
cout<<“Jumlah hari 31\n”;
break;
case 3:
cout<<“Jumlah hari 31\n”;
break;
case 5:
cout<<“Jumlah hari 31\n”;
break;
case 7:
cout<<“Jumlah hari 31\n”;
break;
case 8:
cout<<“Jumlah hari 31\n”;
break;
case 10:
cout<<“Jumlah hari 31\n”;
break;
case 12:
cout<<“Jumlah hari 31\n”;
break;
case 4:
cout<<“Jumlah hari 30\n”;
break;
case 6:
cout<<“Jumlah hari 30\n”;
break;
case 9:
cout<<“Jumlah hari 30\n”;
break;
case 11:
cout<<“Jumlah hari 30\n”;
break;
default:
cout<<“Kode Bulan Salah!!!\n”;
break;
}
getch();
return 0;
}

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

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

Create a free website or blog at WordPress.com.

%d bloggers like this: