You are right. I made the String(char letter, int repeat) constructor but I changed some of it according to the suggestions of another user and it works better now.
Printable View
I'm sure you'll find out as soon as you use them. It's rather obvious.
You should make the first one return a const char& or a char since the function is const and you shouldn't be providing non-const access to the member data. But that's not the obvious thing that is wrong with them.
if i is -1 you will return buf[-1] - out of bounds access
in this case using i == stringlength will give you the out of bound access
How do I make the print function use printf() to output the name of the string, the string literal, and the size of the string literal with the three all displayed on one line per string object?
What is string name?
like
?Code:printf("%s: %s(%d)\n", name, buf, stringlength);
But why do you need a printf if you trying to write in C++?