當前位置:編程學習大全網 - 編程語言 - WEDWIN編程

WEDWIN編程

//自己改。我之前做的那個小練習,沒有農歷什麽的,就是壹個簡單的小程序。。

// -

//by J。

//制作時間:2006年9月11

//2007年8月20日更新

// -

//功能:輸入年份,輸出今年的月、日、周。

//有效期到:2100.12.438+0。

// -

# include & ltiostream.h & gt

# include & ltstdio.h & gt

# include & ltstdlib.h & gt

# include & ltconio.h & gt

Static char week[7][7]={ "星期日"、"星期壹"、"星期二"、"星期三"、"星期四"、"星期五"和"星期六" };

void print_month(int month,int day,int leap,int *w)

{

cout & lt& lt月份& lt& lt"月份"

for(int t 1 = 0;t 1 & lt;4;t1++)

cout & lt& lt'-';

cout & lt& ltendl

for(int j = 0;j & lt7;j++)

cout & lt& ltweek[j]& lt;& lt\ t ';

cout & lt& ltendl

for(int k = 0;k & lt* w;k++)

cout & lt& lt\ t ' & lt& lt' ';

for(int I = 1;我& lt=天;i++)

{

cout & lt& lt我& lt& lt\ t ' & lt& lt結束;

如果(++ * w & gt;= 7)

{

* w = 0;

cout & lt& ltendl

}

}

if(month = = 2 & amp;& ampleap == 1)

{

cout & lt& lt我;

如果(++ * w & gt;= 7)

{

* w = 0;

cout & lt& ltendl

}

}

cout & lt& ltendl & lt& ltendl

for(int T2 = 0;t2 & lt55;t2++)

cout & lt& lt'*';

cout & lt& ltendl

}

void main()

{

int year,leap=0,w;

int月;

//clrscr();

//char week[7][4]= { " SUN "," MON "," TUE "," WED "," THU "," FRI "," SAT " };

while(1)

{

系統(“cls”);

while(1)

{

cout & lt& lt"請輸入1990-2100:"

CIN & gt;& gt年份;

如果(年份& gt2100 | |年& lt1990)

{

Printf("輸入超過有效壽命!\ n ");

getch();

系統(“cls”);

}

其他

{

打破;

}

}

for(int T2 = 0;t2 & lt18;t2++)

cout & lt& lt'~';

cout & lt& ltendl & lt& ltendl

if(年份% 4 = = 0 & amp& amp年份%100!= 0 ||年%400 == 0)

leap = 1;

其他

閏= 0;

//確定壹年中第壹天的星期

w =((年- 1990)*365 +(年-1990+1)/4+1)% 7;

for(month = 1;月份& lt= 12;月++)

{

開關(月)

{

案例1:案例3:案例5:案例7:案例8:案例10:案例12:

{

print_month(month,31,閏年& ampw);

打破;

}

案例4:案例6:案例9:案例11:

{

print_month(月,30,閏,和。w);

打破;

}

案例二:

{

print_month(月、28日、閏年和月。w);

打破;

}

}//開關

}//月末

while(1)

{

char ch

cout & lt& lt“要不要再查詢壹次?(y/n)" & lt;& ltendl

ch = getch();

if(ch == 'y ')

{

系統(“cls”);

打破;

}

else if(ch == 'n ')

{

退出(1);

}

其他

{

cout & lt& lt輸入無效,請重新選擇& lt& ltendl

}

}

}

}

  • 上一篇:什麽是網路埠
  • 下一篇:簡單的英語縮略詞
  • copyright 2024編程學習大全網