Print a string sequentially

Hi everyone,

Anyone knows how to print a string sequentially.
Basically, i made an application (with a GUI) and i want on the screen to print out a string sequentially.

For example: Lets say:
String str = "Hi my name is Mans";

What i would like to do is to print out the string str, character by character with a timer after each character printed out.

See the printing output is the same way as we are writing on the keyboard.

For example, i wanna print out "Hi my name is mans"
So the output is gonna be like:
H (timer = 2seconds) i (timer = 2seconds) m (timer = 2seconds) etc...

Is this clear?


Thanks for u help...

well then you'll have to print it manually.
1
2
3
4
5
6
7
8
9
10
11
string str;//string to print
int timer=0;//you need this to measure time
int ch=0;//this indicates which char to print

while(true){
    if(timer < Time() && ch < str.length()){
        PrintChar(str[ch]);
        timer = Time()+200;
        ch++;
    }
}

Functions Time() and PrintChar(ch) don't exist. You have to use whatever your api gives you. If you were making a console app you could use clock() (from <ctime>) and cout<<ch.
Good luck
Not so sure about the time part as i've never worked with time but I would change 'ch' and 'str.length()' in the above example to an std::string::iterator and str.end()
Topic archived. No new replies allowed.