So I was trying to make a calender that outputs what ever month is prompted. yet this wont run, i keep getting this error
1>c:\users\lukas shininger\documents\visual studio 2008\projects\calender2\calender2\calender.cpp(151) : error C2059: syntax error : '}'
#include <iostream>
#include <string>
using namespace std;
int main(){
int month,dateCount,dayCount,blankCount,totalDates,i;
/*month: userinput variable between 1 and 12
dateCount: a counter to iterate through the dates of a specific month
dayCount: a counter to iterate from 0 to 6 (Sunday to Saturday)
blankCount: a counter to align the first day of a month to a specific day of the week
totalDate: the total number of days in a specific month
i: a general counter
*/
string monthName;// a string to store the name of a month
char flag;//flag to determine if the user wants to continue
cout <<"I will display the calendar for the month you choose in 2008.\n";
do{
cout << "please input the month you wish to see corisponding with its number.\n";
cin >> month;
/* Based on the user input, obtain the name of a month, the totalDates, and the day of the first day in that month (blankCount)
use a switch statement to switch on the month value
for each case, assign the name of the month to monthName
assign value to the total dates
calculate the blankCount
case 1 is given as an example
*/
switch (month){
case 1:
monthName="January";
totalDates=31;
blankCount=2;
break;
switch (month)
case 2:
monthName="Febuary";
totalDates=29;
blankCount=5;
break;
switch (month)
case 3:
monthName="March";
totalDates=31;
blankCount=6;
break;
switch (month)
case 4:
monthName="April";
totalDates=30;
blankCount=2;
break;
switch (month)
case 5:
monthName="May";
totalDates=31;
blankCount=4;
break;
switch (month)
case 6:
monthName="June";
totalDates=30;
blankCount=0;
break;
switch (month)
case 7:
monthName="July";
totalDates=31;
blankCount=2;
break;
switch (month)
case 8:
monthName="August";
totalDates=31;
blankCount=5;
break;
switch (month)
case 9:
monthName="September";
totalDates=30;
blankCount=1;
break;
switch (month)
case 10:
monthName="October";
totalDates=31;
blankCount=3;
break;
switch (month)
case 11:
monthName="November";
totalDates=30;
blankCount=6;
break;
switch (month)
case 12:
monthName="December";
totalDates=31;
blankCount=1;
break;}
/* write out other cases and default below*/
/* after the switch statement, you should have obtained the monthName, totalDates, and the number of
blanks (i.e. blankCount) for that month*/
cout << monthName << "2008\n";
/*output headers here*/
cout <<"Sun\tMon\tTues\tWed\tThurs\tFri\tSat\n";
cout <<"===\t===\t===\t===\t===\t===\t===\n";
//output blanks to prepare for the first day of month. Use a for statement here
for (i=1;i<=blankCount; i++){
cout <<" \t";
}
for(i=1; i <= totalDates; i++){
cout << i << "\t";
dayCount++;
if (dayCount==7){
cout << "\n";
dayCount=0;}
//output the calendar below
cout << "Do you wish to see another month? Y/N or y/n?\n";
cin >> flag;
//check if the user wants to continue or not
}
while(flag != 'n' || flag != 'N');
cout <<"\n\nAll done. Bye";
return 0;
}}