I'm asked to Write a program to create a calendar and I have a problem with defining the first day in every month whether it's satureday or sunday, etc
can anyone give me a hint to fix this
BTW, I'm not allowed to use functions :/
I'm disappointed about my poor calendar :(
here it is:

#include <iostream>
#include<string.h>
using namespace std;

int main()
{
int month,year,days,n;
bool leap;
cin>>month;
cin>>year;
if(month==1||month==3||month==5||month==7||month==8||month==10||month==12)
   {
    days=31;
   }
else if(month==2)
   {
    if(year%400==0)
    {
    days=29;
    leap=true;
    }
    else if(year%100==0)
    {
    days=28;
    leap=false;
    }
    else if(year%4==0)
    {
    days=29;
    leap=true;
    }
    else
    {
    days=28;
    leap=false;
    }
   }
else 
   {
    days=30;
   }
string week_days="sat\tsun\tmon\ttue\twed\tthu\tfri";


cout<<week_days<<endl;

   for(int i=1; i<=days; i++)
     {
           cout<<i<<"\t";
            if(i%7==0)
            {cout<<endl;}
     }                

   cout<<endl;  
    system("PAUSE");
    return 0;




       cout<<endl;  
        system("PAUSE");
        return 0;
    }

Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.