求一C語言高手幫我看看那裡錯,關於求圓面積的程式

時間 2022-10-21 00:30:45

1樓:董俊錕

#include

void main()

double mj(double r)

2樓:

我稍微改了下,不知行不行

#include

void main()

double mj(double a)

我感覺是輸入輸出型別不對,把單精度的硬輸到雙精度的,把雙精度的硬作單精度輸出。

比如double就要用在f前加個l,long也是這樣

3樓:匿名使用者

#include

double mj(double r);

void main()

double mj(double r)

我把宣告放在了上面,scanf()把f換成了lf

4樓:匿名使用者

你把你求面積函式double mj(double r)裡的r 換成其他字元

5樓:漂絲客

不懂耶 , ,去qq群找相關的群問人吧

c語言,這段**求圓的面積,錯誤在哪?

6樓:匿名使用者

int x

double r

好像傳遞的引數型別不對。

求高手幫我看一下這乙個c語言程式,到底是**出錯了。

7樓:鈍角111度

#include

void main()}

8樓:前景一片光明

break加在case一行中第乙個分號後。

9樓:lzh劉振華

沒有加break的話,case語句會從上到下執行下去,本程式中會把所有的printf語句執行一遍。

c語言初學者,哪位高手看看我這段程式**錯了?

10樓:我是比丘猴

#define pi=3.141592654

這裡不用等號,空格就可以了,即

#define pi 3.141592654

11樓:

第一行的巨集定義「#define pi=3.141592654 」改成這個「#define pi 3.141592654 」,不要等於號,把等於號換成空格就行了,它放在第一行、第二行都一樣。

12樓:百小度

第一行的巨集定義 #define pi 3.141592654這樣就行了

樓主威武

13樓:匿名使用者

s=pi*r*r;

pi還沒有巨集定義應該在頭部加上 #define pi 3.14

14樓:餘聰

嗯,我也是這麼想的,還有,你的**要寫規範一點

c語言高手進 看下這個程式**錯了 我是新手 r=1到r=10時圓的面積, 知道area大於100時停止

15樓:匿名使用者

問題蠻多啊:r跟area都沒有定義啊,修改後應該是這樣的:

#include

#include

int main()

}前面那個人回答的r的值永遠都是0.00000,因為他定義的是int而你的輸出是浮點型的。

16樓:匿名使用者

#include

#include

#include

int main()

{float pi=3.14159;

int r;

float area;

for(r=1;r<=10;r++)

{area=pi*r*r;

if(area>100)break;

printf(

17樓:匿名使用者

首先,你沒有定義半徑r和面積area,面積最好定義為double型,還有你求的是面積吧,那個printf語句中只要輸出乙個就可以了,即printf("%f",area);

希望可以幫到你哦

#include "stdio.h"

main()

printf("%f",area);}

18樓:匿名使用者

恭喜你沒定義r和area

19樓:匿名使用者

你在**定義了area???

c語言求圓面積流程圖,要求判斷半徑!

20樓:匿名使用者

程式:#include

#define pi 3.14159

int main()

求C語言高手,求C語言高手

numerical recipes in c 一書及所附程式,有完整程式。不過我封裝了它的c 版本,可以對但引數或多引數求極值,完整的標頭檔案為 ifndef optimization h define optimization h class toptimization 求函式乙個或多個引數的最小...

求c語言高手幫忙,求C語言高手幫忙

include include int findnovowel char str,int num,char res 20 int novowel char s void sort char s 20 int n int main char res 10 20 int n findnovowel st...

C語言程式設計高手幫我

f int a main 解釋 2 1 4 7 2 1 5 8 2 1 6 9 2 2 2 主函式的a從沒變過 1 1 1 b作為函式裡乙個動態變數每次都是新的賦值4 5 6 c是靜態的,只定義一次,然後改了就是改了7 8 9 廢話 2 1 4不是7麼 至於 5d 就是右對齊 靠右 然後有5為那麼寬...

c語言高手請進,幫我解釋小程式,C語言高手請進,幫我解釋乙個小程式。。。

這個不是c語言的吧,下面這個是c語言的 for a 1 a 2 a for b 1 b 3 b for c 1 c 4 c 第一次 a 1,b 1,c 1,a a b c 3 輸出3 2 a 1,b 1,c 2,a a b c 4 輸出4 3 a 1,b 1,c 3,a a b c 5 輸出5 4 ...

c語言問題,求高手解答,C語言問題 求高手解答!!

這是基本的語法啊,先翻書看看吧 不懂的再問。2 int pn 1 n1,pn 2 n2 4 printf ld ld n pch 1,pch 2 5 printf ld ld n pn 1,pn 2 6 printf ld ld n pd 1,pd 2 7 printf c c n pch 1,pc...