一纸一笔
2015-04-18 01:26
#include <stdio.h>
int main()
{
/* 定义需要计算的日期 */
int year = 2008;
int month = 8;
int day = 8;
/*
* 请使用swtich语句,if...else语句完成本题
* 如有想看小编思路的,可以点击左侧任务中的“不会了怎么办”
* 小编还是希望大家独立完成哦~
*/
int a,b;
switch(month)
{
case 1:a=0;break;
case 2:a=31;break;
case 3:a=59;break;
case 4:a=90;break;
case 5:a=120;break;
case 6:a=151;break;
case 7:a=181;break;
case 8:a=212;break;
case 9:a=243;break;
case 10:a=273;break;
case 11:a=304;break;
case 12:a=334;break;
default:printf("一年只有12个月哟!\n"); break;
}
a=a+day;
if(year%400==0||(year%4==0&&year%100!==0))
b=1;
else
b=0;
if(b=1&&month>2)
a++;
printf("%d年%d月%d日这一天是该年中的第%d天。",year,month,day,a);
return 0;
}
错在哪?提示为:In function 'main':
error: expected expression before '=' token
if(year%400==0||(year%4==0&&year%100!==0))这行最后面!=多了一个等于号
C语言入门
926866 学习 · 21068 问题
相似问题