error C2018: unknown character '0xac'
发布网友
发布时间:2022-04-22 20:27
我来回答
共1个回答
热心网友
时间:2023-09-26 07:51
主要是逗号全角的问题,改成半角就行了
====================================
#include"stdio.h"
struct date
{
int year;
int month;
int day;
}dat={0,0,0}; /*对结构体变量赋初值 */
void main()
{
int year,month,day;
int x;
int days(int,int,int);
scanf("%d,%d,%d",&year,&month,&day);
x=days(year,month,day);
printf("%d年%d月%d日在本年中是第%d天。",year,month,day,x);
}
int days(int datyear,int datmonth,int datday)
{
int i,sum;
if(datyear%4==0&&datyear%100==0||datyear%400==0)
{
int month[12]={31,29,31,30,31,30,31,31,30,31,30,31};
for(i=0;i<datmonth;i++)
sum=sum+month[i];
}
else
{
int month[12]={31,28,31,30,31,30,31,31,30,31,30,31};
for(i=0;i<datmonth;i++)
sum=sum+month[i];
}
return (sum);
}