C中关于#include<windows.h>的问题
#include<stdio.h>voidmain(){intmax(intx,inty);inta,b,c;printf("pleaseinputtwonumber:"...
#include<stdio.h>
void main()
{
int max(int x,int y);
int a,b,c;
printf("please input two number:");
scanf("%d,%d",&a,&b);
c=max(a,b);
printf("max is %d\n",c);
}
int max(int x,int y)
{
int z;
if(x>y)
z=x;
else
z=y;
return(z);
}
我为解决在非C界面运行程序时闪退的问题,在#include<stdio.h>后加个#include<windows.h>,并在printf()后加上system("pause");
但是我加上他们后,系统提示我:
C:\Program Files\Microsoft Visual Studio\COMMON\MSDev98\Bin\d.cpp(5) : error C2146: syntax error : missing ')' before identifier 'x'
C:\Program Files\Microsoft Visual Studio\COMMON\MSDev98\Bin\d.cpp(5) : error C2065: 'x' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\COMMON\MSDev98\Bin\d.cpp(5) : error C2146: syntax error : missing ')' before identifier 'y'
C:\Program Files\Microsoft Visual Studio\COMMON\MSDev98\Bin\d.cpp(5) : error C2065: 'y' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\COMMON\MSDev98\Bin\d.cpp(5) : error C2059: syntax error : ')'
C:\Program Files\Microsoft Visual Studio\COMMON\MSDev98\Bin\d.cpp(5) : error C2146: syntax error : missing ')' before identifier 'x'
C:\Program Files\Microsoft Visual Studio\COMMON\MSDev98\Bin\d.cpp(5) : error C2059: syntax error : ')'
C:\Program Files\Microsoft Visual Studio\COMMON\MSDev98\Bin\d.cpp(5) : error C2146: syntax error : missing ')' before identifier 'y'
C:\Program Files\Microsoft Visual Studio\COMMON\MSDev98\Bin\d.cpp(5) : error C2059: syntax error : ')'
C:\Program Files\Microsoft Visual Studio\COMMON\MSDev98\Bin\d.cpp(5) : error C2059: syntax error : ')'
C:\Program Files\Microsoft Visual Studio\COMMON\MSDev98\Bin\d.cpp(13) : error C2199: syntax error : found 'int (' at global scope (was a declaration intended?)
C:\Program Files\Microsoft Visual Studio\COMMON\MSDev98\Bin\d.cpp(13) : error C2062: type 'int' unexpected
C:\Program Files\Microsoft Visual Studio\COMMON\MSDev98\Bin\d.cpp(13) : error C2059: syntax error : ')'
C:\Program Files\Microsoft Visual Studio\COMMON\MSDev98\Bin\d.cpp(13) : error C2143: syntax error : missing ';' before '{'
C:\Program Files\Microsoft Visual Studio\COMMON\MSDev98\Bin\d.cpp(13) : error C2447: missing function header (old-style formal list?)
执行 cl.exe 时出错.,这是为什么啊,求解!!! 展开
void main()
{
int max(int x,int y);
int a,b,c;
printf("please input two number:");
scanf("%d,%d",&a,&b);
c=max(a,b);
printf("max is %d\n",c);
}
int max(int x,int y)
{
int z;
if(x>y)
z=x;
else
z=y;
return(z);
}
我为解决在非C界面运行程序时闪退的问题,在#include<stdio.h>后加个#include<windows.h>,并在printf()后加上system("pause");
但是我加上他们后,系统提示我:
C:\Program Files\Microsoft Visual Studio\COMMON\MSDev98\Bin\d.cpp(5) : error C2146: syntax error : missing ')' before identifier 'x'
C:\Program Files\Microsoft Visual Studio\COMMON\MSDev98\Bin\d.cpp(5) : error C2065: 'x' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\COMMON\MSDev98\Bin\d.cpp(5) : error C2146: syntax error : missing ')' before identifier 'y'
C:\Program Files\Microsoft Visual Studio\COMMON\MSDev98\Bin\d.cpp(5) : error C2065: 'y' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\COMMON\MSDev98\Bin\d.cpp(5) : error C2059: syntax error : ')'
C:\Program Files\Microsoft Visual Studio\COMMON\MSDev98\Bin\d.cpp(5) : error C2146: syntax error : missing ')' before identifier 'x'
C:\Program Files\Microsoft Visual Studio\COMMON\MSDev98\Bin\d.cpp(5) : error C2059: syntax error : ')'
C:\Program Files\Microsoft Visual Studio\COMMON\MSDev98\Bin\d.cpp(5) : error C2146: syntax error : missing ')' before identifier 'y'
C:\Program Files\Microsoft Visual Studio\COMMON\MSDev98\Bin\d.cpp(5) : error C2059: syntax error : ')'
C:\Program Files\Microsoft Visual Studio\COMMON\MSDev98\Bin\d.cpp(5) : error C2059: syntax error : ')'
C:\Program Files\Microsoft Visual Studio\COMMON\MSDev98\Bin\d.cpp(13) : error C2199: syntax error : found 'int (' at global scope (was a declaration intended?)
C:\Program Files\Microsoft Visual Studio\COMMON\MSDev98\Bin\d.cpp(13) : error C2062: type 'int' unexpected
C:\Program Files\Microsoft Visual Studio\COMMON\MSDev98\Bin\d.cpp(13) : error C2059: syntax error : ')'
C:\Program Files\Microsoft Visual Studio\COMMON\MSDev98\Bin\d.cpp(13) : error C2143: syntax error : missing ';' before '{'
C:\Program Files\Microsoft Visual Studio\COMMON\MSDev98\Bin\d.cpp(13) : error C2447: missing function header (old-style formal list?)
执行 cl.exe 时出错.,这是为什么啊,求解!!! 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询