使用Visual Studio 2013时.c文件中出现语法错误

使用Visual Studio 2013时.c文件中出现语法错误,c,visual-studio-2013,syntax-error,C,Visual Studio 2013,Syntax Error,我正在教我弟弟一些C基础知识,下面是代码: /*Program for cicrumference and surface calculation.*/ #include <stdio.h> // Standard input and output. #define PI 3.141593; // Constant pi. main() {

我正在教我弟弟一些C基础知识,下面是代码:

/*Program for cicrumference and surface calculation.*/
#include <stdio.h>                                  // Standard input and output.
#define PI 3.141593;                                // Constant pi.
main() {                                            // Main program.
    double r;                                       // Radius.
    printf("Enter the radius: ");                   // Requesting radius input.
    scanf("%lf", &r);                               // Radius input.
    printf("\nCircumference:    %.6f", r * 2 * PI); // Printing the circumference. // ERR
    printf("\nSurface:          %.6f", r * r * PI); // Printing the surface.       // ERR
    getchar(); getchar();                           // Pause.
}
/*用于循环参考和曲面计算的程序*/
#包括//标准输入和输出。
#定义PI 3.141593;//常数π。
main(){//main程序。
双r;//半径。
printf(“输入半径:”;//请求半径输入。
scanf(“%lf”,&r);//半径输入。
printf(“\n周长:%.6f”,r*2*PI);//打印周长//错误
printf(“\n曲面:%.6f”,r*r*PI);//打印曲面//错误
getchar();getchar();//暂停。
}
我发现以下错误:

错误C2059:语法错误:')'

错误C2143:语法错误:在“;”之前缺少“)”

将常量
PI
用作
printf
函数第二个参数表达式的一部分


我做错了什么?

您没有为预处理器
#define
s(也没有为我现在能记住的任何其他指令,例如:是否为
include
s添加分号?)

预处理器的子替换是文字,它插入分号,因此最终代码是

printf("\nCircumference:    %.6f", r * 2 * 3.141593;);

这显然是一个语法错误。

您没有为预处理器
#define
s(也没有为我现在能记住的任何其他指令,例如:是否为
include
s添加分号?)

预处理器的子替换是文字,它插入分号,因此最终代码是

printf("\nCircumference:    %.6f", r * 2 * 3.141593;);

这显然是一个语法错误。

似乎我会从和他重复这些基础知识中获益d根据您使用的编译器,您可以使用
gcc
执行
gcc-E
,以检查后预处理器结果。似乎我会从与他重复的基础知识中获益:d根据所使用的编译器,可以使用
gcc
执行
gcc-E
来检查后预处理器结果。