Calendar formatting

Having problems formatting this calendar, I am getting:

Welcome to crainey2's calendar program.

Please enter a year: 2014
Please enter the name of the month: March
Please enter the number of days in the month: 31
Please enter the day the month starts
[0=Sun|1=Mon|2=Tue|3=Wed|4=Thu|5=Fri|6=Sat]: 6

March 2014
Su Mo Tu We Th Fr Sa
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31
Press any key to continue . . .

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include <iostream>
#include <string>
#include <iomanip>

using namespace std;

int main()
{
string month;
	int year, daysInMonth, day;

cout << "Welcome to crainey2’s calendar program.\n" << endl;
cout << "Please enter a year: ";
	cin >> year;
	cout << "Please enter the name of the month: ";
	cin >> month;
	cout << "Please enter the number of days in the month: ";
	cin >> daysInMonth;
	cout << "Please enter the day the month starts\n [0=Sun|1=Mon|2=Tue|3=Wed|4=Thu|5=Fri|6=Sat]: ";
cin >> day;

cout << "\n" << setw(10) << month << " " << year << endl;
cout << " Su Mo Tu We Th Fr Sa" << endl;
	
	if (day == 0)
    {
		cout << right << setw(3);
    }
    else if (day == 1)
    {
		cout << right << setw(10);
    }
    else if (day == 2)
    {
		cout << right << setw(14);
    }
    else if (day == 3)
    {
		cout << right << setw(18);
    }
    else if (day == 4)
    {
		cout << right << setw(22);
    }
    else if (day == 5)
    {
		cout << right << setw(26);
    }
    else if (day == 6)
    {
		cout << right << setw(30);
    }

	int daysInWeek = day;

	for (int i = 1; i <= daysInMonth; i++)
	{
		if (daysInWeek == 7)
		{
			cout << "\n";
			daysInWeek = 0;
		}
	
		cout << setw(3) << i;
		daysInWeek++;
	}

	cout << endl;

	system("PAUSE");
	return 0;
}


There are other things I have to program I just need help formatting the first line of the days. We are only able to use for, while, do while, and if statements.

My sample output posted a little weird, everything lines up under the 2nd character of the days, just the first line is lining up on the wrong side as in the 1 is under Sunday instead of the other days of the week.
Topic archived. No new replies allowed.