Compiler errors 错误:应为“a”&引用;

Compiler errors 错误:应为“a”&引用;,compiler-errors,Compiler Errors,我是一个尝试使用VS 2012 Ultimate学习C语言编程的初学者 我刚刚学会了如何制作一个“摄氏到华氏”的转换器,所以我决定将它进一步应用到“球体体积”计算器中。这是我键入的内容: #include <stdio.h> #include <string.h> char line[100]; /*Line input by the user*/ char line_2[100]; /*Second line input by the user*/ float rad

我是一个尝试使用VS 2012 Ultimate学习C语言编程的初学者

我刚刚学会了如何制作一个“摄氏到华氏”的转换器,所以我决定将它进一步应用到“球体体积”计算器中。这是我键入的内容:

#include <stdio.h>
#include <string.h>

char line[100]; /*Line input by the user*/
char line_2[100]; /*Second line input by the user*/
float radius; /*Value of the radius input by the user*/
float pi; /*Value of the pi input by the user*/
float volume /*Result of the calculation*/
float result_volume; /*Result of the second calculation*/
float result_volume2; /*Result of the third calculation*/
float result_volume3; /*Result of the fourth calculation*/

int main()
{
    printf("Please write the value of the radius: ");
    fgets(line,sizeof(line),stdin);
    sscanf(line,"%f",&radius);
    printf("Please write the value of the Pi ");
    fgets(line_2,sizeof(line_2),stdin);
    sscanf(line_2,"%f",&pi);
    volume = radius*radius*radius;
    result_volume = volume *pi;
    result_volume2 = result_volume*4;
    result_volume3 = result_volume2/3;
    printf("When the radius is %f, and the Pi, %f, then the volume of the sphere is: 
                %f\n", radius, pi, result_volume3);
    return (0);
}

我是在哪里犯的错误,我该如何纠正?请帮忙

在您显示的代码中,
在之后丢失

float volume /*Result of the calculation*/
应该是:

float volume; /*Result of the calculation*/
注意:当您遇到此类错误时,通常应查看发生错误的行之前的行。在您的情况下,这是前一行

发生的情况是,编译器只在到达
时才看到问题在下一行。在那里,它意识到整个两行不会发出一个命令,应该在某个地方发生剪切。但它无法判断在哪里。因此,它在看到错误时标记错误,而不是在错误实际发生的位置


然而,在这个领域已经有了显著的改进,例如,使用Clang,MAC OS X IDE Xcode能够准确地提示
任何需要的地方。

在您显示的代码中,
在之后丢失

float volume /*Result of the calculation*/
float volume /*Result of the calculation*/
float result_volume; /*Result of the second calculation*/
应该是:

float volume; /*Result of the calculation*/
注意:当您遇到此类错误时,通常应查看发生错误的行之前的行。在您的情况下,这是前一行

发生的情况是,编译器只在到达
时才看到问题在下一行。在那里,它意识到整个两行不会发出一个命令,应该在某个地方发生剪切。但它无法判断在哪里。因此,它在看到错误时标记错误,而不是在错误实际发生的位置

然而,在这个领域已经有了显著的改进,例如,使用Clang,MAC OS X IDE Xcode能够准确地提示
任何需要的地方

float volume /*Result of the calculation*/
float result_volume; /*Result of the second calculation*/
浮动卷
之后忘记了分号(

float volume; /*Result of the calculation*/
float result_volume; /*Result of the second calculation*/
浮动卷
之后忘记了分号(

float volume; /*Result of the calculation*/
float result_volume; /*Result of the second calculation*/