How would i go about making a program wait before printing the next line? Keep in mind that i would like the next line to print automatically after a few seconds. Also if at all possible i would like to know how to make the text act like it is typing itself out on the screen.
geg13
0
Newbie Poster
Recommended Answers
Jump to PostThe most popular method of delay is to use the Sleep() function, a member of the <windows.h> library.
Jump to Post#include<iostream>
#include<windows.h>int main(){ string str = "hello"; cout<<str<<" "; Sleep(1000); //wait 1 second cout<<"world\n"; return 0; }
All 5 Replies
Clinton Portis
211
Practically a Posting Shark
geg13
0
Newbie Poster
mrnutty
761
Senior Poster
geg13
0
Newbie Poster
Clinton Portis
211
Practically a Posting Shark
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.