作者bunbunsugar (冲啦)
看板C_and_CPP
标题[问题] 没有宣告?
时间Tue Jun 23 23:35:47 2009
#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)
1F:→ netsphere:要空格阿~ 06/23 23:41
2F:推 Peruheru:point P1, <<就像你宣告float s, a,那样 06/23 23:43
3F:→ bunbunsugar:原来如此 已经好了 谢谢 ^^ 06/23 23:44