calendar formatting

so far this is what i have as far as formatting the calendar..however i need it the calendar to use the day the month starts on and start from there and have teh days continue to next line like a calendar on the wall ...how would i go about doing this using user input of when the day of the month starts on ex. 0-sunday, 1 - monday.... starts
sorry my english may be a bit bad



switch(day)
case 1:

{
if (7 - day == 1)

for (x = 1; x <= 31; x++ )
{cout << x << setw(5);
if (x % 7 == 0)
cout << "\n";}
break;
}
1
2
3
4
5
6
7
8
int offset;//if 0 - month starts with monday, if 6 - with sunday;
for(int i = 0; i < offset; ++i)
    std::cout << ' ' << std::setw(5); //Sorry don't want to thik of better way now
for(int x = 1; x <= DAYS_IN_MONTH; ++x) {
    std::cout << x << std::setw(5);
    if( (x + offset) % 7 == 0 )
        std::cout << '\n';
}
Last edited on
Topic archived. No new replies allowed.