bonjour,comment je peux concaténer deux char
exemple
char c1,c2;
merci
bonjour,comment je peux concaténer deux char
exemple
char c1,c2;
merci
Avec une std::string ?
SVP, pas de questions techniques par MP. Surtout si je ne vous ai jamais parlé avant.
"Aw, come on, who would be so stupid as to insert a cast to make an error go away without actually fixing the error?"
Apparently everyone. -- Raymond Chen.
Traduction obligatoire: "Oh, voyons, qui serait assez stupide pour mettre un cast pour faire disparaitre un message d'erreur sans vraiment corriger l'erreur?" - Apparemment, tout le monde. -- Raymond Chen.
bonjour,
avec la fonction strcat
non ça marche que pour les char* et pas les char
voila un exemple
char a1=char(1);
char a2=char(2);
voila
merci
Ouh le vilain pas beau qui encourage l'utilisation de fonctions C.
Plus sérieusement:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 #include <string> ... std::string result(2); result[0]=c1; result[1]=c2;
std::string result(2); me renvoie un erreur
error C2664: '__thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::std::basic_string<char,struct std::char_traits<char>,class s
td::allocator<char> >(const class std::allocator<char> &)' : cannot convert parameter 1 from 'const int' to 'const class std::allocator<char> &'
Reason: cannot convert from 'const int' to 'const class std::allocator<char>'
No constructor could take the source type, or constructor overload resolution was ambiguous
Partager