Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

少了个','

Posted by frkstyc at 2005-08-08 12:41:05 on Problem 2350
In Reply To:为什么会出现Compile Error Posted by:tcxgsy at 2005-08-08 12:39:58
> #define M 1001
> #include"stdio.h"
> #include"math.h"
> 
> double aver(int a[M],int m)
> { 
>    long sum=0;
>    double aver;
>    int i,j=0;
>   for(i=1;i<=m;i++)
>     sum+=a[i];
>      aver=sum/m;
>      for(i=1;i<=m;i++)
>       if(a[i]>aver)  j++;
>    m=(double)j/(double)m;
>    return(m*100);
> }
> main()
> { int n,m,i;
>   int a[M];
>   double d;
>   scanf("%d",&n);
>   while(n)
>    {   scanf("%d"&m);
>         for(i=1;i<=m;i++)
>           scanf("%d",&a[i]);
>      d=aver(a,m);
>      printf("%.3lf%c\n",d,'%');
>       n--;
>      }
> }
> 
> 
> Compile Error 
> Main.c
> 604945\Main.c(24) : error C2296: '&' : illegal, left operand has type 'char [3]'
> 604945\Main.c(24) : error C2198: 'scanf' : too few actual parameters
> 
> 
> 

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator