عندي مشكله بالبرنامج انه ما بيطلع الايام مزبوطه
يعني البرنامج ماشي تمام بس بدايه الشهور غلط
#include <iostream.h>
void month1 ( void );
void week1 ( void );
void day1 ( int y);
int loop1 ( int x );
int daystart , year;
void main ()
{
cout << " enter the year ";
cin >> year;
cout << " enter the daystart in this year "<< year;
cout << " sunday=1" << endl;
cout << " monday=2" << endl;
cout << " tusday=3" << endl;
cout << " wednesday=4" << endl;
cout << " thuresday=5"<< endl;
cout << " friday=6" << endl;
cout << " saturday=7"<< endl;
cin >> daystart;
month1 ();
}
void week1 ( void )
{
cout << "\tsun mon tues wed thur fri sat "<< endl;
}
int loop1( int y)
{
if ( year==0)
{
return 0;
}
else
if (year%100!=0 && year%4==0)
{
return 1;
}
else
if ( year%4==0)
{
return 1;
}
else
{
return 0;
}
}
void day1 ( int y )
{
int count=0;
int loop,i,x;
int s[12]={31,28,31,30,31,30,31,31,30,31,30,31};
if (y==1)
{
x=loop1( year );
loop=s[y]+x;
}
else
{
loop=s[y];
}
for ( i=1;i<daystart;i++)
{
cout << " ";
count++;
}
for (i=1;i<=loop;i++)
{
cout <<"\t" << i;
count++;
if ( count==7)
{
cout << endl;
count=0;
}
}
daystart=count;
cout << endl;
}
void month1 ( )
{
cout << "January"<< endl;
cout << " ___________"<< endl;
week1 ();
day1 (0);
cout <<"February"<< endl;
cout << " ___________"<< endl;
week1 ();
day1 (1);
cout << "March"<< endl;
cout << " ___________"<< endl;
week1 ();
day1(2);
cout << "April"<< endl;
cout << " ___________"<< endl;
week1();
day1 (3);
cout << "May"<< endl;
cout << " ___________"<< endl;
week1 ();
day1 (4);
cout << "June"<< endl;
cout << " ___________"<< endl;
week1 ();
day1 (5);
cout << "July"<< endl;
cout << " ___________"<< endl;
week1();
day1 (6);
cout << "August "<< endl;
cout << " ___________"<< endl;
week1 ();
day1 (7);
cout << "September"<< endl;
cout << " ___________"<< endl;
week1();
day1 (8);
cout << "October"<< endl;
cout << " ___________"<< endl;
week1 ();
day1 (9);
cout << "November"<< endl;
cout << " ___________"<< endl;
week1 ();
day1 (10);
cout << "December"<< endl;
cout << " ___________"<< endl;
week1 ();
day1 (11);
}