LAB_1
unknown
c_cpp
2 years ago
694 B
5
Indexable
#include <iostream> #include <cmath> using namespace std; bool belongsToCircle(float x, float y, float radius) { return x * x + y * y <= radius * radius; } const float MIN_RADIUS = 4; const float MAX_RADIUS = 8; int main() { float x, y; cout << "enter x"<< endl; cin >> x; cout << "enter y"<< endl; cin >> y; //Find out whether the coordinates belong to min radius or max if(belongsToCircle(x, y, MIN_RADIUS) && x > 0) cout << "Belongs to the min radius! " << endl; else if (belongsToCircle(x, y, MAX_RADIUS) && x > 0) cout << "Belongs to the max radius!" << endl; else cout << "Missed the circle" << endl; return 0; }
Editor is loading...