Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- #include <cmath>
- using namespace std;
- int main()
- {
- double Ax, Ay, Bx, By, d, b, x1, y1;
- char komenda;
- do
- {
- system("cls");
- cout << "Podaj wspolrzedne punktu A: ";
- cin >> Ax >> Ay;
- cout << "Podaj wspolrzedne punktu B: ";
- cin >> Bx >> By;
- cout << "Podaj odleglosc od punktu A: ";
- cin >> b;
- d = pow((Bx - Ax)*(Bx - Ax) + (By - Ay)*(By - Ay), 0.5);
- x1 = Ax + b * (Bx - Ax) / d;
- y1 = Ay + b * (By - Ay) / d;
- cout << "Szukany punkt to (" << x1 << ',' << y1 << ")\n";
- cout << "Czy kontynuowac? (t/n) ";
- do
- {
- komenda = getch();
- komenda = toupper(komenda);
- } while(komenda != 'T' && komenda != 'N');
- } while(komenda == 'T');
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement