本人才学C不久,目前只会用<graphics.h>写图形,但是这次遇上的问题是当使用<graphics.h>时不能用scanf 、printf等函数了。所以我请大神们出出主意,怎样可以美化我这个程序!万谢万谢
#include <stdio.h>
#include <graphics.h>
//#include <stdlib.h>
//#include <conio.h>
//#include <ctype.h>
/*id art()
{
setinitmode(INIT_TOPMOST);
initgraph(640,480);
setbkcolor(WHITE);
getch();
closegraph();
}*/
int RYear(int year)
{
if((year%4==0&&year%100!=0)||(year%400==0))
return 1;
else
return 0;
}
int month_day(int year,int month)
{
int monthday[]={31,28,31,30,31,30,31,31,30,31,30,31};
if(RYear(year)&&month==2)
return 29;
else
return(monthday[month-1]);
}
int Day(int year,int month,int day)
{
int s;
if(RYear(year))
{
int w[]={0,3,4,0,2,5,0,3,6,1,4,6};
s=year+year/4+year/400-year/100-2+w[month-1]+1;
}
else
{
int u[]={0,3,3,6,1,4,0,3,5,0,3,5};
s=year+year/4+year/400-year/100-1+u[month-1]+1;
}
return ((int)s%7);
}
void PrintYearmonthday(int year,int month)
{
int temp;
int j;
printf("\n%d年%d月\n",year,month);
temp=Day(year,month,1);
if(temp==0)
temp=7;
printf("星期一 星期二 星期三 星期四 星期五 星期六 星期天\n");
for(j=1;j<month_day(year,month)+temp;j++)
{
if(j-temp<0)
printf("
");
else
printf("%3d
",j-temp+1);
if(j%7==0)
printf("\n");
}
}
int main()
{
int year,month,x;
do
{
printf("请输入年:");
scanf("%d",&year);
printf("请输入月:");
scanf("%d",&month);
PrintYearmonthday(year,month);
printf("您需要继续查询吗?输入1继续查询:");
scanf("%d",&x);
} while (x==1);
printf("您本次查询完成!");
return 0;
}