為什么執(zhí)行程序出錯?
#include <stdio.h>
int main()
int year = 2014;
{
if((year%4==0&&year%100!=0)||year%400==0)
{
? printf("%s\n","今年是閏年");
}
else
{ ?
? printf("%s\n","今年是平年");
} ?
return 0;
}
? ?
Compiling...
四月五號.c
F:\教程\VC6.0精簡版[支持C、C++]\vc6精簡版[中文版]\Microsoft Visual Studio\MyProjects\四月五號\四月五號.c(3) : error C2085: 'year' : not in formal parameter list
F:\教程\VC6.0精簡版[支持C、C++]\vc6精簡版[中文版]\Microsoft Visual Studio\MyProjects\四月五號\四月五號.c(3) : error C2143: syntax error : missing ';' before '='
F:\教程\VC6.0精簡版[支持C、C++]\vc6精簡版[中文版]\Microsoft Visual Studio\MyProjects\四月五號\四月五號.c(4) : error C2449: found '{' at file scope (missing function header?)
F:\教程\VC6.0精簡版[支持C、C++]\vc6精簡版[中文版]\Microsoft Visual Studio\MyProjects\四月五號\四月五號.c(14) : error C2059: syntax error : '}'
執(zhí)行 cl.exe 時出錯.
四月五號.exe - 1 error(s), 0 warning(s)
請問哪里出錯?
2015-04-08
int year = 2014;
{
這兩行代碼的位置對調(diào)一下