首页 > 电脑

E0167"int"类型的实参与"constchar*"类型的形参不兼容什么问题怎么解决

更新时间2019-06-09 23:26:04

#include <stdio.h>

#include <stdlib.h>

#define Pi 3.1415927


int main()

{

double Input,ra;

printf("Please input your number to calcution what you want 1.Ball's Volume 2.Surface Area of The Ball ");

scanf("%lf", &Input);

if (Input == 1) 

{

printf(" V=(4/3)πr^3 Please input 'r' ");

scanf("%lf",&ra);

int f = (4 * Pi * ra * ra * ra / 3);

printf(f);这步显示f出错,int类型实参与const char*类型实参不兼容

getchar();

return 0;

}


按你的程序作了必要的几处修改:
#include <stdio.h>
#include <stdlib.h>
#define Pi 3.1415927
int main()
{
  double Input,ra,f;
  printf("Please input your number to calcution what you want 1.Ball's Volume 2.Surface Area of The Ball ");
  scanf("%lf", &Input);
  if (Input == 1)
    {
     printf("  V=(4/3)Pi*r^3 Please input 'r' ");
     scanf("%lf",&ra);
     f = (4 * Pi * ra * ra * ra / 3);
     printf("%lf",f);
     getch();
    }
 return 0;
}
程序能够运行了:

E0167"int" 类型的实参与 "const char *" 类型的形参不兼容 什么问题怎么解决


但是你的 2.Surface Area of The Ball 程序还未加入。

上一篇:这个配置怎么样

下一篇:一个C语句中至少应包含一个A.逗号B.冒号C.分号D.函数