【文件属性】:
文件名称:C语言用于考试复习的二十道题
文件大小:10KB
文件格式:RAR
更新时间:2014-03-19 03:23:19
C语言
/* Note:Your choice is C IDE */
#include "stdio.h"
#include "conio.h"
#include "string.h"
#include "math.h"
#include "stdlib.h"
int main()
{
int year,month,day;
int days[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int sum=0;
int i;
printf("Please input the year:");
scanf("%d",&year);
if(year%4==0&&year%100!=0||year%400==0)
{
days[1]=29;
}
month=1;
do
{
if(month<1||month>12)
{
printf("The month is error:");
scanf("%d",&month);
}
else
{
printf("Please input the month:");
scanf("%d",&month);
}
}while(month<1||month>12);
day=1;
do
{
if(day<1||day>days[month-1])
{
printf("The day is error:");
scanf("%d",&day);
}
else
{
printf("Please input the day:");
scanf("%d",&day);
}
}while(day<1||day>days[month-1]);
for(i=0;i<=month-2;i++)
{
sum+=days[i];
}
sum+=day;
printf("\nThe day %d of the month %d is the %d dayth of this %d year!",day,month,sum,year);
}
【文件预览】:
C语言复习二十大题
----12.txt(1KB)
----13.txt(792B)
----20.txt(697B)
----5.txt(1KB)
----Graphics.txt(7KB)
----1.txt(1KB)
----Calendar.txt(1KB)
----Password.txt(605B)
----16.txt(1KB)
----4.txt(621B)
----18.txt(2KB)
----6.txt(392B)
----3.txt(281B)
----7.txt(360B)
----随机数的用法.txt(493B)
----8.txt(509B)
----9.txt(630B)
----10.txt(997B)
----11.txt(1KB)
----2.txt(1KB)
----17.txt(461B)
----15.txt(907B)