hello...how are you to day????
I thing is so nice??? :P
lets make a program again...
dhis is the declaration..
#include
#include
#include
class Kabisat
{
private:
int l;
char tahun[4];
public:
Kabisat();
void hitungKabisat();
friend istream &operator >> (istream &in, Kabisat &);
friend ostream &operator << (ostream &out, Kabisat &); }; Kabisat::Kabisat(){ cout << "MENENTUKAN TAHUN KABISAT" << endl;} void Kabisat::hitungKabisat() { if ( l % 4 == 0) strcpy(tahun,"Bukan Tahun kabisat"); else strcpy(tahun,"tahun kabisat"); } istream &operator >> (istream &in, Kabisat &masukan)
{
cout<<" Memasukan tahun : " ; in>>masukan.l;
return in;
}
ostream &operator << (ostream &out, Kabisat &tampil) { tampil.hitungKabisat(); out << tampil.l << " "<< tampil.tahun << endl; return out; } int main() { Kabisat x; cin >> x;
cout << x;
system ("pause");
return EXIT_SUCCESS;
}
I thing is so nice??? :P
lets make a program again...
dhis is the declaration..
#include
#include
#include
class Kabisat
{
private:
int l;
char tahun[4];
public:
Kabisat();
void hitungKabisat();
friend istream &operator >> (istream &in, Kabisat &);
friend ostream &operator << (ostream &out, Kabisat &); }; Kabisat::Kabisat(){ cout << "MENENTUKAN TAHUN KABISAT" << endl;} void Kabisat::hitungKabisat() { if ( l % 4 == 0) strcpy(tahun,"Bukan Tahun kabisat"); else strcpy(tahun,"tahun kabisat"); } istream &operator >> (istream &in, Kabisat &masukan)
{
cout<<" Memasukan tahun : " ; in>>masukan.l;
return in;
}
ostream &operator << (ostream &out, Kabisat &tampil) { tampil.hitungKabisat(); out << tampil.l << " "<< tampil.tahun << endl; return out; } int main() { Kabisat x; cin >> x;
cout << x;
system ("pause");
return EXIT_SUCCESS;
}


Posting Komentar