I would like help with making a program 'type' out the text as the program is running i.e. not having the entire line appear at once but letter by letter.

Edited 7 Years Ago by geg13: n/a

put a system pause between letters. Assuming you are coding on MS-Windows.

#include <windows.h>
string msg = "This is a test";
for(int i = 0; i < msg.length(); i++)
    cout << msg[i]; cout.flush();
    sleep(1000); // delay 1 second

I had thought of that but then i thought about the fact that my program has string values on pretty much every second line. Those values are user input and i don't know how i would make them do the same as the rest of the program.

Could you please explain it in a simpler manner or provide an example? I've just started learning c++

void foo(const char* str)
   // display the string contents here

int main()
   foo("Once upon a time ...");
   foo("there were three little pigs.");
   // etc etc

Edited 7 Years Ago by Ancient Dragon: n/a

I think i should ask at a later date when i know a bit more about c++ because i want to know what the code does... but thanks for the help anyways

This question has already been answered. Start a new discussion instead.