c++ scanf输入问题
#include<iostream>#include<cstdio>#include<cmath>intmain(){doublea,b,c;doubles,p;prin...
#include<iostream>
#include<cstdio>
#include<cmath>
int main()
{
double a,b,c;
double s,p;
printf("input a,b,c/n");
scanf("%lf %lf %lf",&a&b&c);
p=(a+b+c)/2;
s=pow(p*(p-a)*(p-b)*(p-c),1/2);
printf("%f",s);
system("pause");
}
编译的时候出现了问题:invalid operands of types `double*' and `double' to binary `operator&'
这是什么情况? 展开
#include<cstdio>
#include<cmath>
int main()
{
double a,b,c;
double s,p;
printf("input a,b,c/n");
scanf("%lf %lf %lf",&a&b&c);
p=(a+b+c)/2;
s=pow(p*(p-a)*(p-b)*(p-c),1/2);
printf("%f",s);
system("pause");
}
编译的时候出现了问题:invalid operands of types `double*' and `double' to binary `operator&'
这是什么情况? 展开
2个回答
展开全部
#include<iostream>
#include<cstdio>
#include<cmath>
int main()
{
double a,b,c;
double s,p;
printf("input a,b,c/n");
scanf("%lf %lf %lf",&a&b&c); // 缺少逗号,scanf("%lf %lf %lf",&a,&b,&c);
p=(a+b+c)/2;
s=pow(p*(p-a)*(p-b)*(p-c),1/2);
printf("%f",s);
system("pause");
}
没写逗号,编译器把&a&b&c解析成位运算符的 "与运算" 了(本应该是取地址的意思)
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询