help with code of calendar

hello i got a homework to do a c++ calendar for november 2012 , but something wrong with that code the numbers it the third line move right. and are not under ther 2 lines me please

#include <iostream>

using namespace std;

void main()
{ int x=0;
cout<<"S "<<"M "<<"T "<<"W "<<"T "<<"F "<<"S "<<endl;

for (int i=-3; i<=30; i++)

{ if (i<=0)

cout<<" ";


cout<<i<<" ";


if (x%7==0)




Because on the third line there are two digits in the numbers, and not just one.

1 2 3
4 5 6 7 8 9 <- one digit
10 11 12 13 14 <- two digits

you'll need to compensate by adding an additional space.
Last edited on
ok and where to add it?thanks
I would add it before the "i"

Your adding a space, it's your homework, spend a few mins and try some things.

If you want a answer, use code tags at least. - Thx-
Topic archived. No new replies allowed.