程序填空_7
源程序:
#include <iostream>
using namespace std;
class line;
class box
{
private:
int color;
int upx,upy;
int lowx,lowy;
public:
friend int same_color(line l,box b); //程序填空
void set_color(int c)
{
color=c;
}
void define_box(int x1,int y1,int x2,int y2)
{
upx=x1;
upy=y1;
lowx=x2;
lowy=y2;
}
};
class line
{
private:
int color;
int startx,starty;
int endx,endy;
public:
friend int same_color(line l,box b);
void set_color(int c)
{
color=c;
}
void define_line(int x1,int y1,int x2,int y2) //程序填空
{
startx=x1;
starty=y1;
endx=x2;
endy=y2;
}
};
int same_color(line l,box b)
{
if(l.color==b.color)
return 1;
return 0;
}
int main()
{
line m;
box n;
m.define_line(3,5,9,8);
n.set_color(0);
return 1;
}
未完

浙公网安备 33010602011771号