sol5 - 5#include #include 1 Accepts two...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
5 ןורתפל אמגוד 1 םילגעמ ךותיח תקידב . #include <stdio.h> #include <math.h> /* Accepts two circles (x1,y1,r1) (x2,y2,r2), returns 1 if they intersect and 0 otherwise */ int do_intersect ( double x1, double y1, double r1, double x2, double y2, double r2); /* Accept two points (x1,y1) (x2,y2), returns the Euclidean distance */ double distance ( double x1, double y1, double x2, double y2); int main() { int ans; double x1,y1,r1,x2,y2,r2; // test #1 x1 = 0; y1 = 0; r1 = 2; x2= 6.3, y2 = 8.1; r2 = 5.2; ans = do_intersect(x1,y1,r1,x2,y2,r2); printf ( "(%g,%g,%g) intersects with (%g,%g,%g)? %d\n" ,x1,y1,r1,x2,y2,r2,ans); // test #2 x1 = 1.3; y1 = 1; r1 = 2.5; x2= 3.9, y2 = 5; r2 = 2.5; ans = do_intersect(x1,y1,r1,x2,y2,r2); printf ( "(%g,%g,%g) intersects with (%g,%g,%g)? %d\n" ,x1,y1,r1,x2,y2,r2,ans); // test #3 x1 = 2; y1 = 3; r1 = 10; x2= 4.1, y2 = 5.1; r2 = 1; ans = do_intersect(x1,y1,r1,x2,y2,r2); printf ( "(%g,%g,%g) intersects with (%g,%g,%g)? %d\n" ,x1,y1,r1,x2,y2,r2,ans); return 0; } int do_intersect ( double x1, double y1, double r1, double x2, double y2, double r2) { double
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/10/2010 for the course CS 463 taught by Professor Can'tsay during the Spring '09 term at Haaga - Helia University of Applied Sciences.

Page1 / 5

sol5 - 5#include #include 1 Accepts two...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online