#include <iostream>
using namespace std;
class zodiak {
private:
int tgl;
int bln;
public:
zodiak (); //constructor
void input();
void output ();
};
zodiak::zodiak() {
cout<<"\tclass nim \n";
}
void zodiak::input(){
cout<<"Masukkan Tanggal Lahir :";
cin>>tgl;
cout<<"Masukkan Bulan Lahir :";
cin>>bln;
cout<<endl;
}
void zodiak ::output(){
if ((tgl>=21 && tgl<=31 && bln == 3) || (tgl>=1 && tgl <=19 && bln ==4)){
cout<<"Aries"<<endl<<endl;}
else if ((tgl>=20 && tgl<=30 && bln == 4) || (tgl>=1 && tgl <=20 && bln ==5)){
cout<<"Taurus"<<endl<<endl;}
else if ((tgl>=21 && tgl<=31 && bln == 5) || (tgl>=1 && tgl <=20 && bln ==6)){
cout<<"Gemini"<<endl<<endl;}
else if ((tgl>=21 && tgl<=30 && bln == 6) || (tgl>=1 && tgl <=22 && bln ==7)){
cout<<"Cancer"<<endl<<endl;}
else if ((tgl>=23 && tgl<=31 && bln == 7) || (tgl>=1 && tgl <=22 && bln ==8)){
cout<<"Leo"<<endl<<endl;}
else if ((tgl>=23 && tgl<=30 && bln == 8) || (tgl>=1 && tgl <=22 && bln ==9)){
cout<<"Virgo"<<endl<<endl;}
else if ((tgl>=23 && tgl<=31 && bln == 9) || (tgl>=1 && tgl <=22 && bln ==10)){
cout<<"Libral"<<endl<<endl;}
else if ((tgl>=23 && tgl<=30 && bln == 10) || (tgl>=1 && tgl <=21 && bln ==11)){
cout<<"Scorpio"<<endl<<endl;}
else if ((tgl>=22 && tgl<=31 && bln == 11) || (tgl>=1 && tgl <=21 && bln ==12)){
cout<<"Sagitarius"<<endl<<endl;}
else if ((tgl>=22 && tgl<=30 && bln == 12) || (tgl>=1 && tgl <=19 && bln ==1)){
cout<<"Capricon"<<endl<<endl;}
else if ((tgl>=20 && tgl<=31 && bln == 1) || (tgl>=1 && tgl <=18 && bln ==2)){
cout<<"Aquarius"<<endl<<endl;}
else if ((tgl>=19 && tgl<=29 && bln == 2) || (tgl>=1 && tgl <=20 && bln ==3)){
cout<<"Pisces"<<endl<<endl;}
else if (tgl>=31 || tgl<=1 ){
cout<<"Tanggal Yang anda masukkan salah";}
else if (bln>=12 || bln<=1 ){
cout<<"Bulan Yang anda masukkan salah";}
else {
cout<<"Tanggal Dan Bulan Salah";}
}
int main(int argc, char *argv[]){
zodiak hjk;
hjk.input();
hjk.output();
system("PAUSE");
return EXIT_SUCCESS;
}
0 komentar:
Posting Komentar