ASCII Art C++ Lorem Ipsum

Hey guys,

I’ve been trying to solve the ASCII Art problem and I’ve been stuck on the “Lorem Ipsum…” Problem. I can’t seem to pinpoint what’s wrong with my code. Seeing the forums, I’m guessing there’s a problem with reading the spaces, so I even included a section in my function that returns the letter code to specifically return 26 ( I used 0 to 25 for the letters) when there’s a space. I’m pretty sure the letter code for a null terminator and a space isn’t the same (correct me if I’m wrong). I really can’t find the cause of this error, and I’d greatly appreciate if you guys could help me out. Thanks in advance!

Here’s my code:


I tried your code and it worked for me

why do you need to tompare char to space here?

“The characters which are not in the intervals [a-z] or [A-Z] will be shown as a question mark in ASCII art.”

You can also turn your char to an uppercase char and remove ‘A’ (you can do a - ‘A’)

I think that your problem is that you don’t know what the Lorem Ipsum Text is. It is a text to test printers, and it has commas(","),and points ("."), so you have to consider that when there is a comma, a point or another non-valid character you have to print an interrogation symbol.

Excuse me for my English. :smile:

1 Like

What @Juanan said, check every non correct character, not just spaces.

Also use the main topic, so topic closed.