invalid conversion from char to const char | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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

14th Aug 2017, 7:21 PM
X-1
X-1 - avatar
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 []
14th Aug 2017, 7:59 PM
Dennis
Dennis - avatar