plzzzzzzz remove the error present in the program
CODE
#include<iostream.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<conio.h>
#include<iomanip.h>
class fortune
{
public:
int printfortune(int Randomize);
};
class process
{
int year,mon,date,rem,year1,mon1,birth_answer;
char month[20];
public:
void enterdate();
void display();
int thirtyone(char *month,int &date);
int thirty(char *month,int &date);
int february(char *month,int &date);
void checkmain();
protected:
char sunsign[20];
char month1[20];
int date1;
}p;
class lucky:public process
{
void aquarius ();
void pisces ();
void aries ();
void taurus ();
void gemini ();
void cancer ();
void leo ();
void virgo ();
void libra ();
void scorpio ();
void sagittarius ();
void capricorn ();
public:
void ProcessSign(char *month,int &date);
}l;
void process::checkmain()
{
cout<<" First of all I need the current date ..."<<" ";
cout<<" Year :";
cin>>year;
if(year<=0||year>10000)
{
do
{
cout<<"Invalid input for year !"<<" ";
cout<<"Please enter the year correctly :"<<" ";
cin>>year;
}while(year<0||year>10000);
}
cout<<"Month :";
cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
cout<<"\t***************************************************************\n";
cout<<"\t* *\n";
cout<<"\t* *\n";
cout<<"\t* *\n";
cout<<"\t***************************************************************\n";
cout<<"\t* 1) January 7) July *\n";
cout<<"\t* 2) February 8) August *\n";
cout<<"\t* 3) March 9) September *\n";
cout<<"\t* 4) April 10) October *\n";
cout<<"\t* 5) May 11) November *\n";
cout<<"\t* 6) June 12) December *\n";
cout<<"\t***************************************************************\n";
cout<<"\n\t\t What is todays date?";
cout<<"\n\t\tEnter the month of todays date ie: january \n\t\t";
gets(month);
cout<<"\n\t\tenter the month(in numeric form)ie: 1\n\t\t";
cin>>mon;
if(mon<=0||mon>12)
{
do
{
cout<<"Invalid input for month !"<<" ";
cout<<"Again enter the month :"<<" ";
gets(month);
cin>>mon;
}while(mon<0||mon>12);
}
cout<<"Date :";
switch(mon)
{
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:{
thirtyone(month,date);
break;
}
case 2:{
thirty(month,date);
break;
}
default:{
thirty(month, date);
break;
}
}
display();
enterdate();
l.ProcessSign(month1,date1);
}
void lucky::ProcessSign(char *month1,int &date1)
{
//cout << "\tYour Sign is : ";
if (!strcmpi (month1, "january")&& date1>=21)
{
strcpy(sunsign,"Aquarius" );
aquarius();
}
if (!strcmpi (month1, "february")&& date1<=19)
{
strcpy(sunsign,"Aquarius ");
aquarius();
}
if (!strcmpi (month1, "february")&& date1>=20)
{
strcpy(sunsign,"pisces ");
pisces();
}
if (!strcmpi (month1, "march")&& date1<=20)
{
strcpy(sunsign,"Pisces ");
pisces();
}
if (!strcmpi (month1, "march")&& date1>=21)
{
strcpy(sunsign,"Aries ");
aries();
}
if (!strcmpi (month1, "april")&& date1<=20)
{
strcpy(sunsign,"Aries ");
aries();
}
if (!strcmpi (month1, "april")&& date1>=21)
{
strcpy(sunsign,"Taurus ");
taurus();
}
if (!strcmpi (month1, "may")&& date1<=21)
{
strcpy(sunsign,"Taurus ");
taurus();
}
if (!strcmpi (month1, "may")&& date1>=22)
{
strcpy(sunsign,"Gemini");
gemini();
}
if (!strcmpi (month1, "june")&& date1<=21)
{
strcpy(sunsign,"Gemini");
gemini();
}
if (!strcmpi (month1, "june")&& date1>=22)
{
strcpy(sunsign,"Cancer");
cancer();
}
if (!strcmpi (month1, "july")&& date1<=22)
{
strcpy(sunsign,"Cancer ");
cancer();
}
if (!strcmpi (month1, "july")&& date1>=23)
{
strcpy(sunsign,"Leo");
leo();
}
if (!strcmpi (month1, "august")&& date1<=22)
{
strcpy(sunsign,"Leo");
leo();
if (!strcmpi (month1, "august")&& date1>=23)
{
strcpy(sunsign,"Virgo ");
virgo();
}
if (!strcmpi (month1, "september")&& date1<=23)
{
strcpy(sunsign,"Virgo");
virgo();
}
if (!strcmpi (month1, "september")&& date1>=24)
{
strcpy(sunsign,"Libra");
libra();
}
if (!strcmpi (month1, "october")&& date1<=23)
{
strcpy(sunsign,"Libra ");
} libra();
if (!strcmpi (month1, "october")&& date1>=24)
{
strcpy(sunsign,"Scorpio");
scorpio();
}
if (!strcmpi (month1, "november")&& date1<=22)
strcpy(sunsign,"Scorpio ");
if (!strcmpi (month1, "november")&& date1>=23)
{
strcpy(sunsign,"Sagittarius ");
sagittarius();
}
if (!strcmpi (month1, "december")&& date1<=21)
{
strcpy(sunsign,"Sagittarius ");
sagittarius();
}
if (!strcmpi (month1, "december")&& date1>=22)
{
strcpy(sunsign,"Capricorn ");
capricorn();
}
if (!strcmpi (month1, "january")&& date1<=20)
{
strcpy(sunsign,"Capricorn ");
capricorn();
}
cout<<"your sunsign:";
puts(sunsign);
}
void process::display()
{
clrscr();
cout<<"Hello.... It's ";
cout<<date;
rem=date%10;
switch(date)
{
case 11:
case 12:
case 13:
case 14:
case 15:
case 16:
case 17:
case 18:
case 19:
case 20:{
cout<<"th ";
goto over;
}
}
switch(rem)
{
case 1:{
cout<<"st ";
break;
}
case 2:{
cout<<"nd ";
break;
}
case 3:{
cout<<"rd ";
break;
}
default:{
cout<<"th ";
break;
}
}
over:
switch(mon)
{
case 1:{
cout<<"January , ";
break;
}
case 2:{
cout<<"February , ";
break;
}
case 3:{
cout<<"March , ";
break;
}
case 4:{
cout<<"April , ";
break;
}
case 5:{
cout<<"May , ";
break;
}
case 6:{
cout<<"June , ";
break;
}
case 7:{
cout<<"July , ";
break;
}
case 8:{
cout<<"August , ";
break;
}
case 9:{
cout<<"September , ";
break;
}
case 10:{
cout<<"October , ";
break;
}
case 11:{
cout<<"November , ";
break;
}
case 12:{
cout<<"December , ";
break;
}
}
cout<<year<<"";
}
int process::thirtyone (char *month,int &date)
{
cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
cout<<"\t***************************************************************\n";
cout<<"\t* *\n";
cout<<setw(9)<<"*"<<setw(34)<<month<<setw(29)<< "*\n";
cout<<"\t* *\n";
cout<<"\t***************************************************************\n";
cout<<"\t* 1) 2) 3) 4) 5) 6) 7) *\n";
cout<<"\t* 8) 9) 10) 11) 12) 13) 14) *\n";
cout<<"\t* 15) 16) 17) 18) 19) 20) 21) *\n";
cout<<"\t* 22) 23) 24) 25) 26) 27) 28) *\n";
cout<<"\t* 29) 30) 31) *\n";
cout<<"\t* *\n";
cout<<"\t***************************************************************\n";
cout<<"\t\tenter the current date IE: 1 -> 31\n \t\t";
cin>>date;
cin.clear();
cin.ignore();
while (date<1 || date >31)
{
cout<<"\t\tThat is not a valid day for\t" << month<<"\n\t\t";
cin>>date;
}
return(date);
}
int process::thirty (char *month,int &date)
{
cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
cout<<"\t***************************************************************\n";
cout<<"\t* *\n";
cout<<setw(9)<<"*"<<setw(34)<<month<<setw(29)<< "*\n";
cout<<"\t* *\n";
cout<<"\t***************************************************************\n";
cout<<"\t* 1) 2) 3) 4) 5) 6) 7) *\n";
cout<<"\t* 8) 9) 10) 11) 12) 13) 14) *\n";
cout<<"\t* 15) 16) 17) 18) 19) 20) 21) *\n";
cout<<"\t* 22) 23) 24) 25) 26) 27) 28) *\n";
cout<<"\t* 29) 30) *\n";
cout<<"\t* *\n";
cout<<"\t***************************************************************\n";
cout<<"\t\tenter the current date IE: 1 -> 30\n \t\t";
cin>>date;
cin.clear();
cin.ignore();
while (date<1 || date >30)
{
cout<<"\t\tThat is not a valid day for\t" << month<<"\n\t\t";
cin>>date;
}
return(date);
}
int process:: february (char *month,int &date)
{
cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
cout<<"\t***************************************************************\n";
cout<<"\t* *\n";
cout<<setw(9)<<"*"<<setw(34)<<month<<setw(29)<< "*\n";
cout<<"\t* *\n";
cout<<"\t***************************************************************\n";
cout<<"\t* 1) 2) 3) 4) 5) 6) 7) *\n";
cout<<"\t* 8) 9) 10) 11) 12) 13) 14) *\n";
cout<<"\t* 15) 16) 17) 18) 19) 20) 21) *\n";
cout<<"\t* 22) 23) 24) 25) 26) 27) 28) *\n";
cout<<"\t* 29) *\n";
cout<<"\t* *\n";
cout<<"\t***************************************************************\n";
cout<<"\t\tenter the current date IE: 1 -> 29\n \t\t";
cin>>date1;
cin.clear();
cin.ignore();
if(year%4==0)
{
while(date<0||date>29) //for leap year
{
cout<<"Invalid date !"<<" ";
cout<<"Again enter the date :"<<" ";
cin>>date;
}
}
else
{
while(date<0||date>28) //for non-leap year
{
cout<<"Invalid date !"<<" ";
cout<<"Again enter the date :"<<" ";
cin>>date;
}
}
}
void process::enterdate()
{
clreol();
cout<<"\n\n *** Date of birth ***"<<"\n";
clreol();
cout<<"\nYear : ";
clreol();
clreol();
cin>>year1;
while(year1>year) //to ensure that the year of birth
{ //gets entered correctly
clreol();
cout<<"\aInvalid input for year !!!";
cout<<"\nThe date of birth cannot be after the current system date !!! ";
cout<<"\nPlease enter the year correctly : ";
clreol();
cin>>year1;
cout<<"\n";
}
while(year1<1000)
{
clreol();
cout<<"Invalid input for year !!! ";
clreol();
cout<<"\nThe year of birth must be of 4 digits!!!";
clreol();
cout<<"\nPlease enter the year correctly : \a";
clreol();
cin>>year1;
cout<<"\n";
}
while(year1<1900)
{
clreol();
cout<<"\a\nAre you sure (Y/N) ? ";
cin>>birth_answer;
cout<<"\n";
while(birth_answer!='Y'&&birth_answer!='y'&&birth_answer!='N'&&birth_answer!='n')
{
clreol();
cout<<"\a\nInvalid input !!! "<<"\n";
clreol();
cout<<"Please enter a correct option (Y/N) : ";
cout<<"\n";
clreol();
cin>>birth_answer;
}
if(birth_answer=='n'||birth_answer=='N')
{
clreol();
cout<<"\nPlease enter the year again : ";
clreol();
cin>>year1;
clreol();
while(year1>year)
{
clreol();
cout<<"Invalid input for year !!! ";
clreol();
cout<<"\nThe date of birth cannot be after the current system date !!! ";
clreol();
cout<<"\nPlease enter the year correctly : \a";
clreol();
cin>>year1;
cout<<"\n";
}
while(year1<1000)
{
clreol();
cout<<"\aInvalid input for year !!! ";
clreol();
cout<<"\nThe year of birth must be of 4 digits!!!\a";
clreol();
cout<<"\nPlease enter the year correctly : ";
clreol();
cin>>year1;
cout<<"\n";
}
}
//end of inner while
while(birth_answer=='y'||birth_answer=='Y')
{
goto jump;
} //end of inner while
} //end of outer while
jump:
clreol();
cout<<"Month : ";
cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
cout<<"\t***************************************************************\n";
cout<<"\t* *\n";
cout<<"\t* *\n";
cout<<"\t* *\n";
cout<<"\t***************************************************************\n";
cout<<"\t* 1) January 7) July *\n";
cout<<"\t* 2) February 8) August *\n";
cout<<"\t* 3) March 9) September *\n";
cout<<"\t* 4) April 10) October *\n";
cout<<"\t* 5) May 11) November *\n";
cout<<"\t* 6) June 12) December *\n";
cout<<"\t***************************************************************\n";
cout<<"\n\t\t What is todays date?";
cout<<"\n\t\tEnter the month of todays date ie: january \n\t\t";
gets(month1);
cout<<"\n\t\tenter the month(in numeric form)ie: 1\n\t\t";
cin>>mon1;
if(mon1<=0||mon1>12)
{
do
{
cout<<"Invalid input for month !"<<" ";
cout<<"Again enter the month :"<<" ";
gets(month1);
cin>>mon1;
}while(mon1<0||mon1>12);
}
while(mon1<=0||mon1>12)
{
clreol();
cout<<"\a\nInvalid input for month !!!"<<"\n";
cout<<"Again enter the month : ";
clreol();
clreol();
cin>>month1;
}
cout<<"Date : ";
clreol();
switch(mon1)
{
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
{
cin>>date1; //for months with 31 days
while(date1<1||date1>31)
{
clreol();
cout<<"\aInvalid date !!!"<<"\n";
cout<<"Again enter the date : ";
clreol();
cin>>date1;
cout<<"\n";
}
break;
}
case 2:
{ //for february
cin>>date1;
if(year1%4==0)
{
while(date1<0||date1>29) //for leap year
{
clreol();
&n