im having the hardest time with this problem it doesnt like my do while loop it doesnt want to do my loop for spacing and doesnt want to do my day pacing with the if else breaks!
#include <iostream.h>
/*
jake sanders
CS115-001
fall 2004
Programing Assignment 3
Program Description:
My program will be able to make a calendar for a
mythical country by asking the user for the number of days
in the month and the day the month begins on. The calendar
outputted will be made up in columns ands rows like you
would see in most common day calendars are.
Program Preconditions:
Input starting day as a letter, which should be
either R,r,B,b,G,g,Y,y,P,p,M,m,O,o,T,t,S,or s, this
representing the colordays Redday,Blueday,Greenday,
Yellowday,Purpleday,Maroonday,Orangeday,Tanday, and
Silverday.
The number of days in the month must be a number
between 27 and 37.
The input of festival month should be entered
either as Y or y for Yes it is a festival month, or N
or n stating NO its not a festival month.
Program Post-conditions:
The output of this program will be a calendar
arranged in columns and in rows making the first row the
days of the week abd the column showing which day of the
month will that day will land on. The calendar will have
27-37 days on it and have 9 days named after colors.
Fesival month- If you choose the month to be a
festival month then the calendar will be outputted
like any other month but 4 days,Maroonday-Silverday,
at the end of the week will not be counted because they
take a break from work and rest during festival month.
*/
char get_start_day();
int get_number_days();
char ask_festival();
int get_blanknum(char startday);
void report_calendar(int numdays,char
festival,char startday,int blanknum);
int main() {
int numdays;
char startday;
char festivalmonth;
int blanknum;
//do
//{
startday=get_start_day();
numdays=get_number_days();
festivalmonth=ask_festival();
blanknum=get_blanknum(startday);
report_calendar(numdays,festivalmonth,startday,blanknum);
char get_start_day(){
char startday;
cout<<"What day does your month start on? "<<endl;
cin>> startday;
while((startday!='r')&&(startday!='R')&&(startday!='G')&&
(startday!='g')&&(startday!='B')&&(startday!='b')&&
(startday!='s')&&(startday!='S')&&(startday!='T')&&
(startday!='t')&&(startday!='O')&&(startday!='o')&&
(startday!='Y')&&(startday!='y')&&(startday!='M') &&
(startday!='m')&&(startday!='P')&&(startday!='p')){
cout<<"PLease enter a correct day: "<<endl;
cin>>startday;
}
return startday;
}
char ask_festival(){
char festivalmonth;
cout<<"Is this month a festival month?";
cin>>festivalmonth;
while((festivalmonth!='N')&&(festivalmonth!='n')&&
(festivalmonth!='y')&&(festivalmonth!='Y')){
cout<<"Invailid entry please enter n for no or yes"
<< "for yes this is a festival month: "<<endl;
cin>>festivalmonth;
}
return festivalmonth;
}
int get_number_days() {
int daynum;
cout<<"Enter the number of days in your month (27-37): "
<<endl;
cin>>daynum;
while((daynum<27)||(daynum>37)){
cout<<"Invalid.Please type a number greater then 27"
<<" but less than 37!: "<<endl;
cin>>daynum;}
return daynum;
}
int get_blanknum(char startday){
int fnum;
switch(startday){
case 'R':
case 'r':
fnum=0;
break;
case 'B':
case 'b':
fnum=3;
break;
case 'G':
case 'g':
fnum=6;
break;
case 'Y':
case 'y':
fnum=9;
break;
case 'P':
case 'p':
fnum=12;
break;
case 'M':
case 'm':
fnum=15;
break;
case 'O':
case 'o':
fnum=18;
break;
case 'T':
case 't':
fnum=21;
break;
case 'S':
case 's':
fnum=24;
break;
}
return fnum;
}
void report_calendar(int numdays,char festivalmonth,
char startday,int blanknum){
cout<<"numdays "<< numdays<<endl;
cout<<" festival "<< festivalmonth<<endl;
cout<<"startday "<<startday<<endl;
cout<<"blanknum "<<blanknum<<endl;
char doagain;
if((festivalmonth=='y')||(festivalmonth=='Y'))
else
cout<<"R B G Y P M O T S"<<endl;
for(char 'k'=" ";k<=blanknum;k++){
cout<<'k'<<endl;
}
for(int i=0;i>=numdays;i++){
cout<<" "<<'i'<<endl;
if((blanknum/3+i==9)||(blanknum/3+i==18)||(blanknum/3+i==27)||(blanknum/3+i==36))
cout<<endl;
else
;
}
cout<<" Would you like to make another?";
cin>>doagain;
while((doagain!='N')&&(doagain!='n')&&(doagain!='Y')&&
(doagain!='y')){
cout<<"Invailid. PLease choose Y or N: "<<endl;
cin>>doagain;
//}when((doagain!='N')&&(doagain!='n'));
}
}
please help!