事情是这样的:确实c具有布尔(真/假)
/*Simple program to calculate the circumference of a circle. */
#include <stdio.h>
#define PI 3.14159
int main()
{
float r1 /*R1 being the radius.*/
/* Since the Circumference is R * PI * 2, or R2 * PI */
/* we do the following */
printf("This is a program that calculates the Circumference\n");
printf("Of a circle. Please enter your radius.\n");
scanf("%f", r1"\n"); /*This being the first number.*/
printf("Your radius times PI times 2 is\n");
/*Now it calculates the circumference. */
printf("%f", (r1 * PI * 2)"\n");
}
我也用C做数学的东西,等等,任何内幕会有所帮助。例如,我想知道我是否可以将#define
Pi作为一个数字或任何该性质的常量,然后在True/False语句中使用它。任何帮助,将不胜感激。
“的#define PI多项[...],并把它作为一个TRUE/FALSE陈述” - 1.不一个声明,一个表达。 2.什么是“布尔函数”? 3.你如何使用PI作为真/假? – 2013-04-27 19:16:56
我想我错了,不是布尔函数,而只是一个布尔值,所以将PI定义为一个数字,然后在那之后有一个True/False?我很抱歉问这个问题不对。 – 2013-04-27 19:19:25
Pi已经在''中定义为'M_PI',请不要定义它。另外,你是指“在Pi之后有真/假”是什么意思? –
2013-04-27 19:20:19