Probleme langage c++
simyamsmasters
Messages postés
45
Date d'inscription
Statut
Membre
Dernière intervention
-
rakai1f3 Messages postés 2 Date d'inscription Statut Membre Dernière intervention -
rakai1f3 Messages postés 2 Date d'inscription Statut Membre Dernière intervention -
Bonjour a tous,
je suis debutant sur ce langage de programmation raison pour laquelle j ai voulu m entrainer en reecrivant la class <string> de la bibliotheque de c++
voici une partie de mes finctions fonctions
int SYSstring::longueur(const char* chaine)
{
int a=0;
while(chaine[a]!='\0')
{
a++;
}
return a;
}
SYSstring::SYSstring()
{
m_chaine = NULL;
m_longueur = 0;
}
SYSstring::SYSstring(const char* chaine)
{
m_longueur = longueur(chaine);
m_chaine=copie(chaine);
}
SYSstring::SYSstring(const SYSstring &chaine)
{
m_longueur = longueur(chaine.m_chaine);
m_chaine = copie (chaine.m_chaine);
}
void SYSstring::operator+=(const char* chaine)
{
int longlong = m_longueur + longueur(chaine);
char *chaineCopie = new char[longlong+1];
for (int i=0; i< m_longueur ; i++)
{
chaineCopie[i] = m_chaine [i];
}
for (int i=m_longueur; i<longlong ; i++)
{
chaineCopie[i] = chaine[i-m_longueur];
}
chaineCopie[longlong]='\0';
delete[] m_chaine;
m_chaine = chaineCopie;
chaineCopie = NULL;
m_longueur = longlong;
}
voici le probleme que j ai rencontré;
int main()
{
SYSstring chaine(""); // lorsque je retire ces """" a l interieur des parentheses le compilateur m enumere une serie
// d erreur incomprehensible
chh +="SIMYAMS MASTERS ";
chh.afficher();
return 0;
}
Merci de bien vouloir m aider je compte sur vous.
je suis debutant sur ce langage de programmation raison pour laquelle j ai voulu m entrainer en reecrivant la class <string> de la bibliotheque de c++
voici une partie de mes finctions fonctions
int SYSstring::longueur(const char* chaine)
{
int a=0;
while(chaine[a]!='\0')
{
a++;
}
return a;
}
SYSstring::SYSstring()
{
m_chaine = NULL;
m_longueur = 0;
}
SYSstring::SYSstring(const char* chaine)
{
m_longueur = longueur(chaine);
m_chaine=copie(chaine);
}
SYSstring::SYSstring(const SYSstring &chaine)
{
m_longueur = longueur(chaine.m_chaine);
m_chaine = copie (chaine.m_chaine);
}
void SYSstring::operator+=(const char* chaine)
{
int longlong = m_longueur + longueur(chaine);
char *chaineCopie = new char[longlong+1];
for (int i=0; i< m_longueur ; i++)
{
chaineCopie[i] = m_chaine [i];
}
for (int i=m_longueur; i<longlong ; i++)
{
chaineCopie[i] = chaine[i-m_longueur];
}
chaineCopie[longlong]='\0';
delete[] m_chaine;
m_chaine = chaineCopie;
chaineCopie = NULL;
m_longueur = longlong;
}
voici le probleme que j ai rencontré;
int main()
{
SYSstring chaine(""); // lorsque je retire ces """" a l interieur des parentheses le compilateur m enumere une serie
// d erreur incomprehensible
chh +="SIMYAMS MASTERS ";
chh.afficher();
return 0;
}
Merci de bien vouloir m aider je compte sur vous.
A voir également:
- Probleme langage c++
- Langage ascii - Guide
- Langage binaire - Guide
- Pascal langage - Télécharger - Édition & Programmation
- Langage visual basic - Télécharger - Langages
- Langage basic gratuit - Télécharger - Édition & Programmation
4 réponses
Erreurs incompréhensibles !!!! Le compilateur ne cause pas chinois !
Il y a des gens qui arrivent bien souvent à les interpréter.
Alors si tu peux nous en donner un échantillon (les 3 ou 4 premières lignes par copier-coller).
Il y a des gens qui arrivent bien souvent à les interpréter.
Alors si tu peux nous en donner un échantillon (les 3 ou 4 premières lignes par copier-coller).