Salut tout le monde j'obtiens une erreur lorsque je veux complier mon programme composé de 4 fichiers:
MP3.h:
- ifndef MP3_H
- define MP3_H
- include <iostream>
- include <string>
using namespace std;
class MP3
{
public:
MP3(string tch,string nomal="Non renseigne",string nomart="non renseigne",int nump,int sec,int size,int nbec);
void saisir();
void afficher();
private:
string titre_;
string album_;
string artiste_;
int numpiste_;
int duree_;
int taille_;
int nbecoute_;
};
- endif
le MP3.cpp:
- include "mp3.h"
MP3::MP3(string tch,string nomal,string nomart,int nump,int sec,int size,int nbec)
{
titre_=tch;
album_=nomal;
artiste_=nomart;
numpiste_=nump;
duree_=sec;
taille_=size;
nbecoute_=nbec;
}
void MP3::saisir()
{
char rep;
cout<<" saisissez le titre de la chanson : ";
cin>>titre_;
cout<<"Y a-t-il un nom d'album? O/N ?"<<endl;
cin>>rep;
while(rep!='o' && rep !='O' && rep!='N' && rep!='n')
{
cout<<"saisie incorrecte, retaper"<<endl;
cin>>rep;
}
if(rep=='o'|| rep=='O')
{
cout<<"saisissez donc le nom de l'album : ";
cin>>album_;
}
cout<<endl<<"saisissez maintenant le nom de l'artiste: ";
cin>>artiste_;
cout<<endl<<" Y a-t-il un numero de piste? O/N "<<endl;
cin>>rep;
while(rep!='o' && rep !='O' && rep!='N' && rep!='n')
{
cout<<"saisie incorrecte, retaper"<<endl;
cin>>rep;
}
if(rep=='o'|| rep=='O')
{
cout<<"saisissez donc le numero de piste : ";
cin>>numpiste_;
}
cout<<endl<<"saisissez maintenant la duree du morceau en secondes : ";
cin>>duree_;
while(duree_<1)
{
cout<<"impossible, veuillez retaper la duree : "<<endl;
cin>>duree_;
}
cout<<endl<<" saisissez la taille du morceau en Ko : ";
cin>>taille_;
while(taille_<1)
{
cout<<"impossible, veuillez retaper la taille : "<<endl;
cin>>taille_;
}
}
void MP3::afficher()
{
cout<<"\ttitre : "<<titre_<<endl;
cout<<"\tnom d'album : "<<album_<<endl;
cout<<"\tnom de l'artiste : "<<artiste_<<endl;
cout<<"\tnumero de piste : "<<numpiste_<<endl;
cout<<"\tduree du morceau : "<<duree_<<endl;
cout<<"\ttaille du morceau : "<<taille_<<endl;
cout<<"\tnombre d'ecoute(s) : "<<nbecoute_<<endl;
}
Maintentant le playlist.h:
- ifndef PLAYLIST_H
- define PLAYLIST_H
- include "mp3.h"
using namespace std;
const int MAX=100;
class Playlist
{
public:
Playlist(string n, MP3 t[],int nbc);
void saisir();
void afficher();
private:
string nom_;
MP3 tab[MAX];
int nbchansons_;
};
- endif
et enfin le playlist.cpp:
- include "playlist.h"
Playlist::Playlist(string n, MP3 t[],int nbc)
{
nom_=n;
nbchansons_=nbc;
for(int i=0;i<MAX;i++)
{
tab[i]=t[i];
}
};
void Playlist::saisir()
{
char rep;
cout<<"saisissez le nom de la playlist : ";
cin>>nom_;
cout<<endl<<"saissisez maintenant les differents Mp3's (au plus 100) :"<<endl;
int i=0;
do
{
cout<<"Mp3 numero "<<i+1<<endl;
tab[i].saisir();
cout<<" Voulez-vous encore entrer des Mp3's ( si oui taper O sinon une autre touche)?"<<endl;
cin>>rep;
i++;
}while((rep=='o' || rep=='O') && i<MAX);
nbchansons_=i;
};
void Playlist::afficher()
{
cout<<"\tNom de la playlist : "<<nom_<<endl;
for(int i=0;i<nbchansons_;i++)
{
cout<<"Morceau numero "<<i+1<<" : "<<endl;
tab[i].afficher();
}
cout<<endl<<" Dans cette playlist il y a "<<nbchansons_<< " chansons "<<endl;
};
et j'obtiens comme message d'erreur:
playlist.cpp line 4 error: no matching for call to 'MP3::MP3()'
mp3.h line 11 note:candidates are MP3::MP3(const MP3&)
mp3.h line 13 note:
MP3::MP3(std::string,std::string,int,int,int,int)
Merci de votre aide!