It's been a long time I didn't program with C++ (i have been working with java which i am not a fan), so i decide to practice.
I'm trying to make a hangman but I have a problem with string replace it keeps saying invalid conversion from char to const char.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
Hangman h("testo"); //class that only contains a string attribute
string t;
t.insert(0,h.getWord().length(),'*');
char m;
int b;
cout<<"enter a letter \n";
cin>>m;
b = h.getWord().find(m);
if ( b >= 0){
t.replace(b,1,h.getWord().getWord()[b]);
//t.replace(b,1,h.getWord().getWord()[b]+"");
//returns string::copy with '*'
}
and if I try t.replace(b,1,h.getWord().getWord()[b]+""); (a way in java to convert into string) and I enter 'e' it gives : *string::copy***