Share your repls and programming experiences

← Back to all posts
C++ slowprint
SilentShadowBla (538)

For people who are doing c++ and want a slowprint function, this took me a LONG time to figure out probs cuz im dumb...:)

Commentshotnewtop
Mapaor4 (4)

Can u explain me the:

for(char c: word)

Never seen it

SilentShadowBla (538)

that basically saying as long as there are still characters in the string it will repeat the action @Mapaor4

Mapaor4 (4)

@SilentShadowBla Would this had been correct?:

for(int i = 0; i < word.size(); i++){
this_thread::sleep_for(chrono::milliseconds(45));
    cout << word[i] << flush;
}
SilentShadowBla (538)

yes longer but still effective @Mapaor4

Roar123 (424)

This is nice! I don't know C++ and I can still appreciate it :)

AshleighBonner (0)

Thanks. I learned new functions. Great job!

Highwayman (1299)

REALLY nice code. very clean!