大家好!
我是c新手,最近写了一个练笔小程式,不知错在哪,请求高手指点迷津!!!
if(ch==’s'||ch==’S')
{
printf(“Input a number :\n”);
scanf(“%d”,&a);
sum=sumup(&a);
printf(“\n\nSumup=%d\n\n”,sum);
}
if(ch==’t'||ch==’T')
{
printf(“Input tow numbers.\n\na=”);
scanf(“%f”,&b1);
printf(“\nb=”);
while(getchar()!=’\n’);
scanf(“%f”,&b2);
c=townum(&b1,&b2);
printf(“\n\n**********The result is:%f **********\n”,c);
}
if(ch!=’s'&&ch!=’S'&&ch!=’t'&&ch!=’T')
printf(“********** sorry, out of cabble! **********\n”);
}
sumup(int *x)
{
int i,sum1,sum2;
for(i=1;i<=*x;i++)
{
sum1=*x-1;
sum2=sum1+*x;
}
return sum2;
}
townum(float *x,float *y)
{
float sum;
sum=*x+*y;
return sum;
} /* 田宁868 */
>> 本文固定链接: http://www.vcgood.com/archives/1772
while(getchar()!=’\n’);
????