I want each letter to be typed with a delay of Sleep(100);
I know there has to be a way to form that into one easy command, instead of doing it the way I just did in my example. Help is greatly appreciated :)
thanks wachtn, thats definitely improvement. However, is it possible to improve it some more? For example, if I would want to have C++ write a few sentences, I think that the current improvement will still take a while because you have to write each letter individually with ' on both sides.
I haven't ever used fstream in particular (however, I have messed around with ostringstream if thats similar), but hey, I guess now is a good time to start learning ;)
It really is a great trick. One of the first programs I wrote was a trivia game. Writing a program to generate the question function saved me a sh(hh this is a family site) lot of typing.
Keep at it. I gave up learning to program because I never thought I would have a use for it. Im only a beginner in C++ but in the last month I wrote 2 simple programs that could end up saving me a lot of time. Its a great feeling you get when you teach a computer to do your job for you.
#include <iostream>
#include <conio.h>
#include <windows.h>
usingnamespace std;
void z() {Sleep(50);}
char x[] = "Hello! This program writes each letter after 0.05 seconds. And it finally works :)#";
int main(){
for (int i=0;x[i]!='#';i++)
{
cout << x[i];
z();
}
getch();
return 0;
}