请教一个C语言中的问题
/*
输入年月,判断该月天数!
*/
#include <stdlib.h>
#include <stdio.h>
int main(void)
{
int year,month;
int days=20;
printf("请输入:\n");
scanf("%c,%c",&year,&month);
if(year%4==0&&year%100!=0||year%400==0){
if(month==2)
printf("days=29");
else if(month==4||month==6||month==9||month==11)
printf("days=30\n");
else
printf("days=31\n");
}else{
if(month==2)
printf("days=28");
else if(month==4||month==6||month==9||month==11)
printf("days=30");
else
printf("days=31");
}
return 0;
system("PAUSE");
}
为什么不按照我的想法来,这个程序,求指定一下!谢谢! c语言
[解决办法]
scanf("%c,%c",&year,&month);year,和month是什么类型?
[解决办法]
你定义的int year,month;
输出的%c?
匹配的到 ?
还有你最后
return 0;
system("PAUSE");
return了,你的窗口能停?
改:system("PAUSE");
return 0;
[解决办法]
数据类型很重要