[問題] 沒有宣告?

看板C_and_CPP (C/C++)作者 (衝啦)時間16年前 (2009/06/23 23:35), 編輯推噓1(102)
留言3則, 3人參與, 最新討論串1/1
#include <stdio.h> #include <math.h> typedef struct{ float x; float y; } point; float distance(pointP1, pointP2) { return sqrt((P1.x-P2.x)*(P1.x-P2.x)+(P1.y-P2.y)*(P1.y-P2.y)); } float triangleArea(pointP1, pointP2, pointP3); { float s, a, b, c; a = distance(P2, P3); b = distance(P1, P3); c = distance(P2, P1); s = (a+b+c)/2; return sqrt(s*(s-a)*(s-b)*(s-c)); } 編譯器下去跑是說 7 C:\Users\user\Desktop\新文件1.cpp `pointP1' was not declared in this scope 不知道他說的沒有宣告是什麼意思? 有高手可以幫我解答嗎,謝謝! ^^ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.127.38.38 ※ 編輯: bunbunsugar 來自: 140.127.38.38 (06/23 23:38)

06/23 23:41, , 1F
要空格阿~
06/23 23:41, 1F

06/23 23:43, , 2F
point P1, <<就像你宣告float s, a,那樣
06/23 23:43, 2F

06/23 23:44, , 3F
原來如此 已經好了 謝謝 ^^
06/23 23:44, 3F
文章代碼(AID): #1AGFPKpo (C_and_CPP)
文章代碼(AID): #1AGFPKpo (C_and_CPP)