Rabu, 20 April 2011

Program Tahun Kabisat

0 komentar

#include <iostream.h>
#include <conio.h>
class kabisat {
                public:
void proses();
                private:
                int n;
                };
void kabisat::proses()
{
cout << "Menentukan tahun kabisat atau bukan"<<endl;
                cout<<"Masukkan tahun: ";
cin>>n;
                if (n % 4 != 0)
        cout << "Tahun " << n << " bukan tahun kabisat" << endl;
    else
        if ((n % 100 == 0) && (n % 400 != 0))
            cout << "Tahun " << n << " bukan tahun kabisat" << endl;
        else
            cout << "Tahun " << n << " tahun kabisat" << endl;
                }
int main()

{
               
               
                kabisat tahun;
               
                tahun.proses();
               
                getch();
                return 0;
               
}
Hasil:

Leave a Reply

Labels