Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- struct Circle {
- double x, y, r;
- };
- int main() {
- Circle c1, c2;
- cout << "Vavedi x, y, r za pуrvata: ";
- cin >> c1.x >> c1.y >> c1.r;
- cout << "Vavedi x, y, r za vtorata: ";
- cin >> c2.x >> c2.y >> c2.r;
- double d = sqrt(pow(c2.x - c1.x, 2) + pow(c2.y - c1.y, 2));
- double sumR = c1.r + c2.r;
- double diffR = abs(c1.r - c2.r);
- if (d == 0) {
- cout << "Koncentrichni" << endl;
- } else if (d > sumR) {
- cout << "Vanshani (ne se dopirat)" << endl;
- } else if (d == sumR) {
- cout << "Dopirashti se vanshno" << endl;
- } else if (d == diffR) {
- cout << "Dopirashti se vatreshno" << endl;
- } else if (d < diffR) {
- cout << "Vatreshni" << endl;
- } else {
- cout << "Sekushti" << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment