error C2296: '%' : illegal, left operand has type 'float ' 执行 cl.exe 时出
#include<stdio.h>#include<stdlib.h>#include<conio.h>floatproc(floath){floatt;t=h*1000...
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
float proc(float h)
{
float t;
t=h*1000%10;
if(t>=5)
h=h*100+1;
else
h=h*100;
return (float)h/100;
}
void main()
{
float f;
system("CLS");
printf("Enter f: ");
scanf("%f",&f);
printf("The original data is : ");
printf("%f\n\n",f);
printf("The result :%f\n",proc(f));
} 展开
#include<stdlib.h>
#include<conio.h>
float proc(float h)
{
float t;
t=h*1000%10;
if(t>=5)
h=h*100+1;
else
h=h*100;
return (float)h/100;
}
void main()
{
float f;
system("CLS");
printf("Enter f: ");
scanf("%f",&f);
printf("The original data is : ");
printf("%f\n\n",f);
printf("The result :%f\n",proc(f));
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询