How to "cout" Text letter by letter | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to "cout" Text letter by letter

Hi, I try to learn C++ at the moment and I want to figure out how to give out a text letter by letter (like you know from typewriters). Is there a special library I could use or how do I do this?

10th Jul 2019, 6:58 PM
Godmorgon
Godmorgon - avatar
3 Answers
+ 2
Yes, with a for loop indeed string test = "bottom text"; for(int i = 0; i < test.length(); ++i) cout << test[i] << endl; (You may need to import <string>) Actually you don't need to
10th Jul 2019, 8:13 PM
alvaro.pkg.tar.zst
alvaro.pkg.tar.zst - avatar
+ 2
How about making a char list and make it output one value at a time but not include the endl or \n at the end of cout? That could work.
10th Jul 2019, 7:45 PM
CeePlusPlus
CeePlusPlus - avatar
0
Maybe it's good for single words, but is there a way to make it easier for a whole text? Maybe with a for loop?
10th Jul 2019, 7:52 PM
Godmorgon
Godmorgon - avatar