注册 登录
编程论坛 C++教室

求大仙指教,急!!!!!

一人 发布于 2010-09-24 13:02, 822 次点击
#include<stdio.h>
#include<math.h>
void main()
{   
 float a,b,c,d,l;
 scanf("%f,%f,%f,%f",&a,&b,&c,&d);
 l=sqrt((c-a)*(c-a)+(d-b)*(d-b));
 printf("%f",l);
刚学c++    求两点距离,找不出哪错了,紧急,在线等
10 回复
#2
一人2010-09-24 13:15
求教啊···大哥大姐们,小弟我好等啊
#3
hahayezhe2010-09-24 13:25
有错吗?
#4
hahayezhe2010-09-24 13:26
没错啊!
#5
小细节2010-09-24 14:34
运行时输入的数之间加逗号没有?
#6
电子门外汉2010-09-24 15:11
main funtion  结尾没加大括号。
#7
电子门外汉2010-09-24 15:18
程序代码:
#include <stdio.h>
#include <math.h>
main()
{float a,b,c,d,l;

 scanf("%f,%f,%f,%f",&a,&b,&c,&d);

 l=sqrt((a-b)*(a-b)+(c-d)+(c-d));

 printf("%f",l);
}
这样就没错了
#8
m21wo2010-09-24 17:53
#include<iostream>
#include<cmath>
using namespace std;
void main()
{   
float a,b,c,d,l;
cin>>a>>b>>c>>d;
l=sqrt((c-a)*(c-a)+(d-b)*(d-b));
cout<<l;
}
大括号掉了!
#9
mghxz2522010-09-24 20:51
8楼的是正解,楼主的程序还是在C阶段,不是C++
#10
xin3109232010-09-24 20:52
c++  用的是cmath而不是math
#11
hnyyzy20082010-09-28 14:12
good!
1