Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cmath>
- #include <fstream>
- #include <iostream>
- using namespace std;
- void atstumas (double x1, double y1, double x2, double y2, double &e);
- void plotas (double atkarpa1, double atkarpa2, double atkarpa3, double &s);
- int main (){
- ifstream duom("duomenys.txt");
- ofstream rez("rezultatai.txt");
- double ax, ay, bx, by, cx, cy, xt, yt, AB, BC, AC, AD, BD, DC, ABC, DBC, DAC, DAB, plotsum;
- duom>>ax>>ay>>bx>>by>>cx>>cy>>xt>>yt;
- atstumas (ax, ay, bx, by, AB);
- atstumas (ax, ay, cx, cy, AC);
- atstumas (bx, by, cx, cy, BC);
- atstumas (bx, by, xt, yt, BD);
- atstumas (xt, yt, cx, cy, DC);
- atstumas (ax, ay, xt, yt, AD);
- plotas (AB, AC, BC, ABC);
- plotas (AD, AB, BD, DAB);
- plotas (AD, DC, AC, DAC);
- plotas (BD, BC, DC, DBC);
- plotsum=DAB+DAC+DBC;
- if (ABC == plotsum) rez<<"Taskas yra trikampio viduje"<<endl;
- else rez<<"Taskas yra trikampio isoreje"<<endl;
- }
- void atstumas (double x1, double y1, double x2, double y2, double &e){
- e=sqrt(((x2-x1)*(x2-x1))+((y2-y1)*(y2-y1)));
- }
- void plotas (double atkarpa1, double atkarpa2, double atkarpa3, double &s){
- double p;
- p=(atkarpa1+atkarpa2+atkarpa3)/2;
- s=sqrt(p*(p-atkarpa1)*(p-atkarpa2)*(p-atkarpa3));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement