📄 rectangle.cpp
字号:
/*************************************************************************** * Copyright (C) 2003 by ita * * tnagy@eleve.emn.fr * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/#include "rectangle.h"rectangle::rectangle(int lo, int la, int xpos, int ypos,bool orient,int num){ longueur = lo; largeur = la; posx = xpos; posy = ypos; orientation = orient; numero = num;};rectangle::rectangle(){ longueur = 0; largeur = 0; posx = 0; posy = 0; orientation = 0; numero = 0;};rectangle::~rectangle(){}; intrectangle::getLongueur(){ if (orientation) return longueur; return largeur;}; intrectangle::getLargeur(){ if (orientation) return largeur; return longueur;}; intrectangle::getYHaut(){ return (posy + getLongueur()); }; intrectangle::getXMax(){ return (posx + getLargeur());}; intrectangle::getSurface(){ return (getLargeur() * getLongueur());};lieu::lieu(){ posx=0; posy=0;}lieu::lieu(int i, int j){ posx=i; posy=j;}bool operator< (rectangle x, rectangle y){ // attention, relation d'ordre oppos閑 (=>tri inverse) return (x.getSurface() > y.getSurface());}bool operator< (lieu x, lieu y){ if ((x.posy < y.posy) ) //or (x.posy == y.posy and x.posx <y.posx)) return 1; return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -