49 lines
No EOL
1.3 KiB
C++
49 lines
No EOL
1.3 KiB
C++
#include "figures.h"
|
|
#include "cellule.h"
|
|
#include "file.h"
|
|
|
|
|
|
int main(){
|
|
rectangle r1=rectangle(5.6,3.1);
|
|
carre c1=carre(5.2);
|
|
triangle t1=triangle(5.2);
|
|
cercle ce1=cercle(4.0,"bleu");
|
|
|
|
figure *tableauDeFigures[4];
|
|
|
|
tableauDeFigures[0]=&r1;
|
|
tableauDeFigures[1]=&c1;
|
|
tableauDeFigures[2]=&t1;
|
|
tableauDeFigures[3]=&ce1;
|
|
|
|
cout << "Informations sur les figures du tableau : " << endl << endl;
|
|
|
|
for(int i=0; i< 4;i++){
|
|
tableauDeFigures[i]->afficherCaracteristiques();
|
|
cout << "type de figure : " << typeid(*tableauDeFigures[i]).name() << endl;
|
|
cout << tableauDeFigures[i]->perimetre() << endl << endl;
|
|
}
|
|
|
|
|
|
cout << "On passe à la partie pointeur" << endl << endl << endl;
|
|
|
|
file *f1=new file();
|
|
cout << "La file est-elle vide ? " << f1->est_Vide() << endl;;
|
|
f1->inserer_Element(&r1);
|
|
f1->inserer_Element(&c1);
|
|
f1->inserer_Element(&t1);
|
|
f1->inserer_Element(&ce1);
|
|
cout << "Le dernier élément est : " << endl;
|
|
f1->get_Derniere()->get_Element()->afficherCaracteristiques();
|
|
cout << "La file est-elle vide ? " << f1->est_Vide() << endl;;
|
|
|
|
while(f1->get_Courante()!=NULL){
|
|
f1->get_Courante()->get_Element()->afficherCaracteristiques();
|
|
cout << "Périmetre : " << f1->get_Courante()->get_Element()->perimetre() << endl;
|
|
f1->avancer();
|
|
}
|
|
|
|
f1->libereeeeeeeeer();
|
|
delete f1;
|
|
return 0;
|
|
} |