当前位置: 代码迷 >> C语言 >> 大家帮帮忙???sos??
  详细解决方案

大家帮帮忙???sos??

热度:348   发布时间:2005-09-07 08:53:00.0
大家帮帮忙???sos??

#include<stdio.h>

#include<dos.h>

#include<stdlib.h>

#include<string.h>

#define MAX 100

#define N atoi(argv[1])

#define maxnum(a,b) (a<b)?b:a

void main(int argc,char *argv[])

{

int i,j;

int s[MAX];

if(argc<2)

{

printf("error:No command line.\n");

printf("you must input the length that you want.\n");

printf("example:max 5\n");

exit(1);

}

if(argc>3)

{

printf("error:Too many paterners!\n");

printf("The exact style :max N\n");

exit(1);

} }

if(argc==3&&!strcmp(argv[2],"sound"))

{

sound(1000);delay(3000);nosound();

sound(800);delay(3000);nosound();

}

printf("Please input numbers:\n");

for(i=0;i<N;i++)

scanf("%d",&s[i]);

for(j=0;j<N;j++)

s[j+1]=maxnum(s[j],s[j+i]);

printf("The max number is %d.\n",s[N-1]);

puts("\nEnd");

} 下面是出错信息: error .. 50:Declaration syntax error 48,62,66,70,72 行和上面的错误是一样的!! 郁闷啊!!费了一晚上也没搞懂??

搜索更多相关的解决方案: sos  

----------------解决方案--------------------------------------------------------
编程的思路是用带参数的main( int argc,char *argv[])来控制参与求最大直的整数的个数;
----------------解决方案--------------------------------------------------------
第3个if前的}多余
----------------解决方案--------------------------------------------------------
  相关解决方案