課本P86

 

1

 

1

 

1

 

4

#include

#include
//#define PI 3.1415926
 
const float PI = 3.1415926;
float CaculateArea( float r ); //宣告函式內容 
// C 語言使用函式前,必須事先宣告函式原型( prototype ) 
// https://openhome.cc/Gossip/CppGossip/FunctionABC.html
 
int main(int argc, char *argv[]) {
float r1;
    while( 1 ) {
printf("半徑="); 
scanf( "%f", &r1);
printf("半徑%.2f的面積=%.2f \n", r1, CaculateArea(r1));
}
 
return 0;
}
float CaculateArea( float r ){
float a = 0;
a = PI*r*r;
return a;
}
 
//-------------------------------------------------
const float PI = 3.1415926;
 
int main(int argc, char *argv[]) 
{
char r1;
while( 1 ) 
{
printf("ASCII="); 
scanf( "%d", &r1);
printf("ASCII%d的顯示=%c \n", r1, r1 );
}
return 0;
}