how to delay the output??

hi everyone~~~~~

just like the title above~~~~~
how to delay the output??

i wanted to output three '.' in a slow motion~~~~
example:

output . (1st second)
output . . (2nd second)
output . . . (3rd second)

can anyone teach me how to do this??
Sleep(unsigned int miliseconds) from windows.h if you are using windows (unistd for linux, correct me if I'm wrong)

BTW - why you always type these tildes?

PS . use @helios advice, my is C-style :P
Last edited on
Sleep is the simpler way, but it's also OS-dependant. If you decide on Sleep, make sure you capitalize the S.
to helios:
thanks~~~~
i will give it a try on this~~~~

to johnkravetzki:
i am learning C++ recently~~~
and i'm a newbie at programming~~~~
about why i like to put this '~~~'
.... maybe its just kind of habit when i was chatting with other people in online game
its hard to see when i write '.' this symbol~~~~ =.='''

to NGen:
sleep?
do you mean i need to type system("Sleep"); in my source code??

to Duoas:
thanks~~~~
i'll take the examples there as a referrence~~~~~
The "Sleep" to which NGen refers is the same as the one used in the Windows section of my code in the link I gave you. (It is a Win32 API function defined in Kernel32.dll .)
Here's an example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <windows.h>
#include <iostream>

int main( ){
    cout << "5" << endl;
    //  We use 1000 since Sleep takes the amount of time in milliseconds, and 1000 ms = 1 second
    Sleep( 1000 );

    cout << "4" << endl;
    Sleep( 1000 );
    cout << "3" << endl;
    Sleep( 1000 );
    cout << "2" << endl;
    Sleep( 1000 );
    cout << "1" << endl;
    Sleep( 1000 );

    cout << "Congratulations, you've just wasted 5 seconds of your life!";
    cin.get( );
    
    return 0;
}
thanks everyone for helping me~~~~~

i'm using ctime to delay the output~~~~~
and finally i managed to work it out~~~~~~~
now i can send my assignment to my teacher~~~~~

actually my assignment is to design a program which acts like an online booking program for booking flight ticket. users are required to input their name, number of passenger, passport of each passenger.

then users are prompt to select their source and destination~~~~
the application should read from input files, named inBoundFlight.txt and outBoundFlight.txt

then users are prompt to input their departure date
the application will then output the user estimated arrival date and time~~~~

the same information should also be written in an external output text~~~~
Did you know you can tie() the cout stream to another stream?
http://www.cplusplus.com/reference/iostream/ios/tie/
=.=''' no~~~~ i didnt know about it~~~~~~

i followed that link to the tie() ~~~~~
but i didnt quite understand the meaning of the description~~~~~

how to actually use the tie() ??
Why don't you compile and execute the example at the bottom of the link?
i tried to compile already~~~~~

about the *cin.tie() ~~~~~why does it need to include a * in front of it??

is the example same as this??

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include<iostream>
#include<fstream>

using namespace std;

int main()
{
      ofstream outData("test.txt");

      cout << "tie example: " << endl;
      cout << "this is inserted into cout. " << endl;
      outData << "this is inserted into the file." << endl;

      outData.close();
}
Topic archived. No new replies allowed.