#include <iostream>
using namespace std;
int pole(int,int,int,int,int,int,int,int);
int main()
{
int x1,x2,y1,y2,x3,y3,y4,x4,suma;
cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
suma=pole(x1,y1,x2,y2,x3,y3,x4,y4);
cout<<suma<<endl;
system("PAUSE");
return 0;
}
int pole(int x1, int y1, int x2,int y2,int x3,int y3,int x4,int y4)
{
int a,b,s=0,c,d,e=0;
a=x1;
if(a>x2) a=x2;
if(a>x3) a=x3;
if(a>x4) a=x4;
c=x1;
if(c<x2) c=x2;
if(c<x3) c=x3;
if(c<x4) c=x4;
b=y1;
if(b<y2) b=y2;
if(b<y3) b=y3;
if(b<y4) b=y4;
d=y1;
if(d>y2) d=y2;
if(d>y3) d=y3;
if(d>y4) d=y4;
for(int i=b;i>=d;i--){
cout<<i<<": ";
for(int j=a;j<=c;j++){
if( ((i<=y2 && i>=y1) && (j<=x2 && j>=x1))) || ((i<=y4 && i>=y3) && (j<=x4 && j>=x3)) )
{ s++; cout<<"x";}
else cout<< " ";
e++;
}
cout<<endl;
}
cout<<"y1="<<y1<<" y2="<<y2<<" x1="<<x1<<" x2="<<x2<<" y3="<<y3<<" y4="<<y4<<" x3="<<x3<<" x4="<<x4<<endl;
return s;
}
I wciąż mam błąd xD załamię się
nie mogę znaleźć błędu ;/