分类：电脑/网络-软件
问题：刚刚学习c语言,弄得我一头雾水,请大虾帮忙检查我的程序里有什嬷错? 
中的解法,运行出现一个问题exam1.2.cpp(10):errorC2447:missingfunctionheader(old-styleformallist?)Errorexecutingcl.exe.,我发现第10句,只是一个括号,也没有发现不妥,请帮助检察。#include<stdio.h>intmax(int,int);voidmain(){intn1,n2;scanf("%d,%d",&n1,&n2);printf("Max=%d\n",max(n1,n2));}intmax(intx,inty);{if(x>y)re中的解法,运行出现一个问题exam1.2.cpp(10):errorC2447:missingfunctionheader(old-styleformallist?)Errorexecutingcl.exe.,我发现第10句,只是一个括号,也没有发现不妥,请帮助检察。#include<stdio.h>intmax(int,int);voidmain(){intn1,n2;scanf("%d,%d",&n1,&n2);printf("Max=%d\n",max(n1,n2));}intmax(intx,inty);{if(x>y)returnx;elsereturny;}我的解法:出现cpp(6):errorC2061:sy 'N01'cpp(8):errorC2181:illegalelsewithoutmatchingifcpp(10):warningC4508:'main':functionshouldreturnavalue;'void'returntypeassumedErrorexecutingcl.exe._exam1.2.2.obj-2error(s),1warning(s)这些提示,我的解法错在哪里?#include<stdio.h>main(){intN01,N02;scanf("%d,%d",N01,N02);ifN01>N02;printf("max=%d\n",N01);elseprintf("max=%d\n",N02);}例1.3求n!。下面是书上的解法,程序没有问题,但是运行结果不对,问题在哪里?#include<stdio.h>intfun(int);voidmain(){intn,m;printf("n:");scanf("%d",&n);m=fun(n);printf("%d!=%d\n",n,m);}intfun(intx){inti,y;y=1;for(i=1;i<=x;i++)y=y*1;returny;}
回答：第一个程序
...
main()//不用void
{
int n1,n2;
scanf("%d,%d",&n1,&n2);                      
printf("Max=%d\n",max(n1,n2));
}
...
 
第二个程序
#include<stdio.h>
main()
{
int N01,N02;
scanf("%d,%d",N01,N02);
if（N01>N02）//条件要括号
printf("max=%d\n",N01);
else
printf("max=%d\n",N02);
}
第三个程序
...
int fun(int x)
{
int i,y;
y=1;
for (i=1; i<=x;i++)
y=y*i;//不是乘1
return y;
}