POINT IN CIRCLE 题解
来源:互联网 发布:网络转载犯法吗 编辑:程序博客网 时间:2024/06/06 12:39
这一题更简单了,求点是否在圆上,直接看离圆心的距离是否等于半径即可
#include <iostream>#include <fstream>#include <string>using namespace std;int main (int argc, char* argv[]) {ifstream file;string lineBuffer;file.open(argv[1]);while (!file.eof()) {getline(file, lineBuffer);if (lineBuffer.length() == 0)continue; //ignore all empty lineselse {double centerX, centerY, radius, pointX, pointY;double x, y;sscanf(lineBuffer.c_str(), "Center: (%lf, %lf); Radius: %lf; Point: (%lf, %lf)", ¢erX, ¢erY, &radius, &pointX, &pointY);x = pointX - centerX;y = pointY - centerY;if(x*x + y*y - radius*radius < 0.01)cout << "true" << endl;elsecout << "false" << endl;}}return 0;}
0 0
- POINT IN CIRCLE 题解
- JAVA Geometry: point in a circle?
- Point-->Circle-->Cylinder
- Point and Circle
- Point类派生Circle类
- Linked List Circle题解
- Point类派生出Circle类
- java 类class Circle 调用 class Point
- UVa 11524 - In-Circle
- Piont in a circle
- Circle in Square LightOJ
- Face in Circle
- HDU 3694Fermat Point in Quadrangle(三分 不过网上大多是费马点的题解)
- codeforces A. Supercentral Point 题解
- LightOJ 1022 Circle in Square
- soj 1621. Circles in Circle
- Changsha F Curve in Circle
- LightOj-1022-Circle in Square
- 使用C内置的float类型来建模一个FIR滤波器
- 今天发现了一个系概念--随机数
- Cocos2d-x 水果忍者划痕效果
- python按行读取文件 去掉换行符"\n"
- jedis基本介绍(2)
- POINT IN CIRCLE 题解
- utm工具(astah 6.7)安装包,破解版(-)
- python 调用 shell python shell 间变量传递
- JAVA环境变量JAVA_HOME、CLASSPATH、PATH设置详解
- What exactly is the difference between “pass by reference” in C and in C++?
- 登录页面缓存,等待
- 使用opencv处理android中的yuv420sp(NV21)图像
- Android数据的四种存储方式SharedPreferences、SQLite、Content Provider和File
- Android横竖屏切换中的状态恢复------不调用Oncreate()的方式