Typed text

How can i get the text that is printed on the screen look like it is being typed by someone else.
Kinda like how it is on Pokemon games or similar.

This is my code if it helps.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <iostream>

using namespace std;

int main()
{
    cout << "You wake up hanging upside down from your parachute, dangling about 15 feet" << endl << "in the air." << endl << endl;
    cout << "In the distance you see a small cave below a cliff." << endl << endl;
    cout << "What do you do?" << endl;
    
    int ch1;
    cout << "1) Scale the cliff" << endl;
    cout << "2) Enter the cave" << endl;
    
    cin >> ch1;
    if (ch1 == 1)
    {
            system("cls");
            cout << "You climb to the top of the cliff and see an ocean so large it fades" << endl << "into the fog on the horizon." << endl << endl;
    }
    else if (ch1 == 2)
    {
            system("cls");
            cout << "You enter the cave and explore for some time before it gets too dark" << endl << "to carry on." << endl << endl;
    }
    system("Pause");
}
if you just mean printing one character at a time, put the text you want to print in a std::string and iterate through it with a for loop, getting each character in turn with string's at() function, and pausing for a short while after each character. To create a pause you'll need to know the current time http://www.cplusplus.com/reference/clibrary/ctime/
Topic archived. No new replies allowed.