if statement to set calendar on right day

im trying to write an if statement to start my calendar on the write day i wanted it to say something like

1
2
if(startday=2)
cout <<setw(8);


but i need to do somthing after that first day go back to a set width of 4?? idk how to do either because my if statement isnt working!

this is the function i want to put it in..


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
void printmonth (const int month, const int startday, const bool leap) 

{  int daysinmonth[13]= {0, 31, 28, 31, 30, 31, 30, 31,  31, 30, 31, 30, 31};

	
	 cout << endl;
	 cout<< setw(14) << Months[month] << endl ;
	 cout << " Sun Mon Tue Wed Thu Fri Sat " << endl;

	 for (int i=1; i<=daysinmonth[month]; i++)
		 cout << setw(4) << i; 

	 if(leap) daysinmonth[2]=29;

	 
	
}




any help would be great! thanks!
Your if statement isn't working because you use = instead of ==.
mmk so how can i make it to where if a day starts on a tuesday, the days will skip 8 spaces at first then go back to the original set width of 4?

this doesnt do anything when i run it..

1
2
if (startday==2) daysinmonth[month];
		 cout << setw(8);

Topic archived. No new replies allowed.