事情是這樣的:確實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