Structures and Pointers – Geometry – Problem #4
IIT Kharagpur CS10001 / CS11001 Programming and Data Structures Lab Question Archive
Problem Statement
Define a structure to represent a circle in terms of coordinates of its centre (a, b) and its radius r. Assume these values to be float. Write a function which takes as input two such structure variables and returns 1 if the circles intersect or if they touch at a point, and 0 if they do not. (Think a bit on how you can handle the case of touching at a point using float variables.) In the main program input six numbers in a1, b1, r1, a2, b2, r2, order and store them in two such structure variables. Next, call this function and print if the input circles, intersect or touch at a point, or do not.