만달력 ¶
당 *^^* 드 게 록 고면 겠다고 고 ㅠㅠ 담 때는 깔게...
~cpp
#include<iostream>
using namespace std;
bool isYunYear(int x); // 부를
int monthDays(int x,int y); // 를 는
int main()
{
int year, month; // year,month는 력 ,
cin >> year >> month; // year 고 , month 는 고 달.
int yunYear4Year = year / 4;
int yunYear100Year = year / 100;
int yunYear400Year = year / 400;
int yunYearTotal = yunYear4Year - yunYear100Year + yunYear400Year;
int weekDay = (year + yunYearTotal) % 7; // (year+z)%7 1
for(int i = 0 ; i < month-1 ; i++)
{
weekDay=( weekDay+monthDays(year,i+1)%7 ) %7; // 력 구다.
}
cout<<""<<"\t"<<""<<"\t"<<""<<"\t"<<""<<"\t"<<"목"<<"\t"<<""<<"\t"<<""<<endl;
for(i=0; i<weekDay; i++)
cout << " \t";
for(i=0 ; i<monthDays(year,month); i++)
{
cout << i+1 << "\t";//날를 대로 력
weekDay = weekDay+1;
if(weekDay==7)//0~6 ~ 라고 때 값 력면 다.
{
weekDay=0;
cout << endl;
}
}
cout<<endl;
return 0;
}
bool isYunYear(int x)// 는
{
if(x%4 ==0)
{
if(x%100 ==0)
{
if(x%400 ==0)
return true;
return false;
}
return true;
}
return false;
}
int monthDays(int x, int y)// 를 는
{
if( y==1 || y==3 || y==5 || y==7 || y==8 || y== 10 || y==12)
return 31;//1 3.... 31 까 다.
else if( y==2)//2 29 또는 28...
{
if(isYunYear(x)==true)
return 29;
return 28;
}
else//그 모두 30
return 30;
}
를 나더 . 드를 가기...
~cpp
#include<iostream>
using namespace std;
bool isYunYear(int x); // 부를
int monthDays(int x,int y); // 를 는
int getMonthWeekDay(int x, int y);
int main()
{
int year, month; // year,month는 력 ,
cin >> year >> month; // year 고 , month 는 고 달.
int yunYear4Year = year / 4;
int yunYear100Year = year / 100;
int yunYear400Year = year / 400;
int yunYearTotal = yunYear4Year - yunYear100Year + yunYear400Year;
int weekDay = (year + yunYearTotal) % 7; // (year+z)%7 1
for(int i = 0 ; i < month-1 ; i++)
{
getMonthWeekDay(weekDay,monthDays(year,i+1)%7); // 력 구다.
}
cout<<""<<"\t"<<""<<"\t"<<""<<"\t"<<""<<"\t"<<"목"<<"\t"<<""<<"\t"<<""<<endl;
for(i=0; i<weekDay; i++)
cout << " \t";
for(i=0 ; i<monthDays(year,month); i++)
{
cout << i+1 << "\t";//날를 대로 력
weekDay = weekDay+1;
if(weekDay==7)//0~6 ~ 라고 때 값 력면 다.
{
weekDay=0;
cout << endl;
}
}
cout<<endl;
return 0;
}
bool isYunYear(int x)// 는
{
if(x%4 ==0)
{
if(x%100 ==0)
{
if(x%400 ==0)
return true;
return false;
}
return true;
}
return false;
}
int monthDays(int x, int y)// 를 는
{
if( y==1 || y==3 || y==5 || y==7 || y==8 || y== 10 || y==12)
return 31;//1 3.... 31 까 다.
else if( y==2)//2 29 또는 28...
{
if(isYunYear(x)==true)
return 29;
return 28;
}
else//그 모두 30
return 30;
}
int getMonthWeekDay(int x, int y)
{
return x=(x+y) %7;
}
곽,









