- Objectives Related Knowledge Problem Analysis Nouns A Point Double X Y A Circle Double R Relative Position Int Resu 1 (138.08 KiB) Viewed 49 times
Objectives Related knowledge Problem Analysis Nouns: A point → double x,y A circle → double r Relative position int resu
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Objectives Related knowledge Problem Analysis Nouns: A point → double x,y A circle → double r Relative position int resu
Objectives Related knowledge Problem Analysis Nouns: A point → double x,y A circle → double r Relative position int result -1: (x,y) is out of the circle 0: (x,y) is on the circle 1: (x,y) is in the circle Practice implementing functions A point p is in a circle if the distance from the center to p is less thanthe radius. Write a C program that will accept a point and a circle having the center is (0,0) then print out the relative position of this point with the circle Suggested algorithm (logical order of verbs) Begin Accept x, y; Do { End Accept r; } While(r<0); result = getRelPos(x,y,r); if (result ==1) Print out "The point is in the circle"; else if (result==0) Print out "The point is on the circle"; else Print out "The point is out of the circle";