fork download
  1. #include <iostream>
  2. #include <fstream>
  3. /* run this program using the console pauser or add your own getch, system("pause") or input loop */
  4. using namespace std;
  5. int main(int argc, char** argv) {
  6.  
  7. int x0=1,x1=0,x2=5,x3=0,y0=1,y1=0,y2=0,y3=5;
  8. double R1,R2,R3;
  9. string ResStr;
  10.  
  11. ifstream file("trian.dat");
  12. /*if (!file.is_open()) {
  13. cout<<"file not open";
  14. return 1;
  15. }*/
  16. file>>x1>>y1;
  17. file>>x2>>y2;
  18. file>>x3>>y3;
  19. file>>x0>>y0;
  20. file.close();
  21.  
  22. /*cout<<x1<<" "<<y1<<endl;
  23. cout<<x2<<" "<<y2<<endl;
  24. cout<<x3<<" "<<y3<<endl;
  25. cout<<x0<<" "<<y0<<endl;*/
  26.  
  27. R1=(x1 - x0) * (y2 - y1) - (x2 - x1) * (y1 - y0);
  28. R2=(x2 - x0) * (y3 - y2) - (x3 - x2) * (y2 - y0);
  29. R3=(x3 - x0) * (y1 - y3) - (x1 - x3) * (y3 - y0);
  30. //cout<<R1<<" "<<R2<<" "<<R3<<endl;
  31.  
  32. ofstream file1("trian.sol");
  33. /*if (!file1.is_open()) {
  34. cout<<"file not open";
  35. return 1;
  36. }*/
  37.  
  38. if ((R1>=0 && R2>=0 && R3>=0)||(R1<=0 && R2<=0 && R3<=0)) {
  39. ResStr="YES";
  40. } else
  41. ResStr="NO";
  42.  
  43. /*file1<<ResStr;
  44. file1.close();
  45. */
  46. return 0;
  47. }
Success #stdin #stdout 0s 16064KB
stdin
Standard input is empty
stdout
Standard output is empty