谁帮我看一下我的C程序怎么错了

来源:百度知道 编辑:UC知道 时间:2024/06/10 00:35:19
程序源代码如下:

#include "stdafx.h"
#include <stdio.h>
#include <string.h>

struct date
{
int flag;
int year;
int month;
int day;
int sum;
};

int main(int argc, char* argv[])
{
struct date a;
a.flag=0;
a.year=0;
a.month=0;
a.day=0;
a.sum=0;

void ruinian(struct date);
void pinnian(struct date);
printf("please input the year month day:\n");
scanf("%d,%d,%d",a.year,a.month,a.day);

if(((a.year%4==0)&&(a.year%100!=0))||(a.year%400==0))
a.flag=1;
else
a.flag=0;

if(a.flag==1)
ruinian(a);
else
pinnian(a);

return 0;
}

void ruinian(struct date a)
{
a.sum=a.day;
switch(a.month)
{
case 12:a.sum+=31;
case 11:a.sum+=30;
case 10:a.sum+=31;
case 9:a.sum+=30;
case

纠正你们
#include "stdafx.h"
在Microsoft Visual Studio 2003/2005里面是一个必须加的头文件,记住了,还问这个是什么,真是低级错误

每个case都要加break吧。
#include "stdafx.h" 是什么?

是stdafx.h头文件的原因,如果不用MFC的话,把它去掉就可以了,或者下载一个stdafx.h stdafx.dll 放到你安装C++的indlude文件里