I am doing a little assignment and came up with a grand idea (lol) of doing a typing effect on the screen, if it is at all possible.
For example, in movies when a computer is talking to a human, you see the letters typing out letter by letter on the screen with a blinking cursor at the end.
"Hello Bob..._"
Is it possible to do this type of effect with C++?
I was thinking of some kind of looping but, with speeds of processors now-a-days that wouldn't help slow down the display of text on the screen.
If your using the console, here are my suggestions. Add #include <windows.h> , if it's not there already. That is for using the Sleep command. It's used as Sleep(1000) That gives a 1 second delay. Play around with the 1000 till you get the delay you want. For printing letter by letter, yes, use a loop.
As
1 2 3 4 5 6 7 8 9 10 11 12 13
int main()
{
string hello = "Hello Bob. Let's get\nprogramming in C++";
int x=0;
while ( hello[x] != '\0')
{
cout << hello[x];
Sleep(500);
x++;
};
cout << "\n\nEnd of message.." << endl << endl;
return 0;
}
EDIT: If you want a sound when each letter is printed, add
1 2
if ( hello[x]!= ' ' && hello[x]!= '\n')
Beep(850, 300);
c++ is not getting in full screen in win 7
it shows the message " the system does not support full screen mode " when i press alt+enter....
how can i get full screen ?