Bonjour à tous, je suis nouveau sur le forum et j'ai un niveau moyen en langage C++. J'ai un problème d'utlisation de mon vecteur "tablbovin", je ne saisis pas mon erreur et cela fait 3 jours que je cherche pourriez vous m'aider. Je vous joints un extrait de mon code qui pose problème, je précise qu'il s'agit d'un header.
#pragma once
#include "stdafx.h"
#include <vector>
typedef class defbovin {
defbovin(void);
~defbovin(void);
int index;
string espece;
double poid;
double prix;
int mois;
int annee;
int identifiant;
char *sexe;
bool genisse;
};
defbovin::defbovin(void){}
defbovin::~defbovin(void){}
typedef class bovin {
public:
bovin(void);
~bovin(void);
vector <defbovin> tablbovin;
private :
void PrintAttributOneBovin( int );
};
bovin::bovin(void){}
bovin::~bovin(void){}
/****************************************************************
Objectifs : Affiche l'ensemble des attributs d'un bovin
****************************************************************/
void bovin::PrintAttributOneBovin(int ligne){
clrscr;
cout<<endl;
cout<<"----- Enr N° "<<ligne<<" ------" <<endl;
cout << "\tNumero d'identification :\t" << &tablbovin[ligne].identifiant << endl;
cout << "\tNé(e) en :\t" << &tablbovin[ligne].mois <<"//"<< &tablbovin[ligne].annee << endl;
cout << "\tSexe :\t" << &bovin.tablbovin[ligne].sexe << endl;
cout << "\tGenisse :\t";
if (&tablbovin[ligne].genisse){
cout << "Oui" << endl;
}else{
cout << "Non" << endl;
}
cout << "\tPoid :\t" << &tablbovin[ligne].poid << endl;
cout << "\tPrix :\t" << &tablbovin[ligne].prix << endl;
}