I can't view the screenshot for some reason. What problem are you having? The code appears to work.
That's because a string (char*)
always has the characters and then the ending character (null)
. So for example:
You think this string contains:
hello
but it really contains:
hello[NULL]
so when printing a char* just use:
std::cout<<mychar;
that does the same thing as what you are trying to do but it formats it properly.
Last edited on
Whats the program supposed to be doing anyway?
It is a simple program.
Search words by first character...
So you enter words then you enter a letter to search for and it prints all the words that start with that letter?
Let us know if you run into anymore problems you need help on. We would be more then willing to help out.