FAKULTAS TEKNOLOGI INFORMASI DAN KOMUNIKASI
Selamat Datang di Forum FTIKOM.

"Information & Communication Technology Faculty"
"UNIVERSITAS MULAWARMAN"


Daftarkan Diri Anda. Selamat Berposting.
Ramekan Forum kita guna memajukan Fakultas kita.

MEMBUAT KALENDER SEDERHANA Logo-u12
Best Regard

Join the forum, it's quick and easy

FAKULTAS TEKNOLOGI INFORMASI DAN KOMUNIKASI
Selamat Datang di Forum FTIKOM.

"Information & Communication Technology Faculty"
"UNIVERSITAS MULAWARMAN"


Daftarkan Diri Anda. Selamat Berposting.
Ramekan Forum kita guna memajukan Fakultas kita.

MEMBUAT KALENDER SEDERHANA Logo-u12
Best Regard
FAKULTAS TEKNOLOGI INFORMASI DAN KOMUNIKASI
Would you like to react to this message? Create an account in a few clicks or log in to continue.

MEMBUAT KALENDER SEDERHANA

Go down

MEMBUAT KALENDER SEDERHANA Empty MEMBUAT KALENDER SEDERHANA

Post  novay Fri Apr 08, 2011 4:35 pm

KETENTUANNYA SEPERTI INI BRAY :

  • PERTAMA INPUTKAN TAHUN DAN KODE BULAN.
    JIKA TAHUN ADALAH TAHUN KABISAT (ARTINYA JIKA TAHUN HABIS DIBAGI 4 ATAU 400 DAN TIDAK BISA DI BAGI 100) DENGAN KODE BULAN 2 MAKA HASILNYA 29 HARI, DAN JIKA TIDAK MAKA HASILNYA 28 HARI.
    JIKA KODE BULAN 1, 3, 5, 7, 8, 10, 12 MAKA HASILNYA ADA 31 HARI.
    JIKA KODE BULAN 4, 6, 9 MAKA ADA 30 HARI.
    DAN APABILA KODE BULAN YANG ANDA INPUTKAN TIDAK SESUAI MAKA AKAN ERROR.



BERIKUT SYNTAXNYA :


// Membuat Kalender Sederhana

#include <iostream.h> //untuk mengenali fungsi cin & cout
#include <conio.h> //untuk mengenali fungsi getche

int main()
{
int tahun,bulan,bil;

cout<<"PROGRAM UNTUK MEMBUAT KALENDER SEDERHANA"<<endl<<endl;
cout<<"Coba Anda Masukkan Tahun : ";
cin>>tahun;
cout<<endl;
cout<<"Masukkan Kode Bulan [Note : 1-12]: ";
cin>>bulan;
cout<<endl;
switch (bulan)
{
case 2:
if ((tahun%100==0)||(tahun%100!=0)&&(tahun%400==0))
{
for(int i=1; i<=29; i++)
{
cout<<i<<" ";
}
}
else
{
for(int i=1; i<=28; i++)
{
cout<<i<<" ";
}
}
break;
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
{
for(int i=1; i<=31; i++)
{
cout<<i<<" ";
}
}
break;
case 4:
case 6:
case 9:
case 11:
{
for(int i=1; i<=30; i++)
{
cout<<i<<" ";
}
}
break;
default:
cout<<"Anda Salah Memasukkan Kode Bulan\n";
}
getch();
}



NIH OUTPUTNYA BRAY

OUTPUT:
novay
novay
Forum Founder [Joker]
Forum Founder [Joker]

Posts : 488
Points : 840
Reputasi : 12
Age : 32
Location : Berau City
Universitas : University Of Mulawarman
Fakultas : Faculty Of Information and Communication Technology

http://ftikom-unmul.nstars.org

Kembali Ke Atas Go down

Kembali Ke Atas

- Similar topics

 
Permissions in this forum:
Anda tidak dapat menjawab topik