+ 1
invalid conversion from char to const char
I'm trying to create a pointer which creates 26 objects, each of which will be assigned to a letter in the alphabet. the class and iteration is all set up, but I keep getting an error(in the title): I have no clue what this means: could someone help? https://code.sololearn.com/cZPldANnAV51/?ref=app
1 Answer
+ 1
for(int i = 0; i<26; i++){
string name{ch+i}; // use curly braces here and add i to ch, no need to use {1, ch+i}, = is also optional here
pPerson[i].setName(name);
pPerson[i].showName(); // Access ith person.
}
delete[] pPerson; // You used new [], so delete with []