[問題] 沒有宣告?
#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
06/23 23:43, 2F
→
06/23 23:44, , 3F
06/23 23:44, 3F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章