C HELP PLEASE!! [modified]
-
/* IM TRYING TO WRITE IT SO THAT I CAN SEE EACH LETTER AS IT IS BEING WRITTEN BY THE COMPUTER*/ /* Thanks :doh: in advance*/ #include main() { printf("\n\nH"); sleep(2); printf("e"); sleep(2); printf("y"); sleep(2); return 0; } /* Im trying to run it one letter at a time*/
modified on Monday, March 9, 2009 8:30 PM
-
/* IM TRYING TO WRITE IT SO THAT I CAN SEE EACH LETTER AS IT IS BEING WRITTEN BY THE COMPUTER*/ /* Thanks :doh: in advance*/ #include main() { printf("\n\nH"); sleep(2); printf("e"); sleep(2); printf("y"); sleep(2); return 0; } /* Im trying to run it one letter at a time*/
modified on Monday, March 9, 2009 8:30 PM
-
I think this is what you want:
#include <stdio.h> main() { printf("\n\nH"); printf("e"); ; printf("y"); printf( "\n" ); return 0; }
BobYes thats good but i want two second delay between each letter written, and going horizontally
-
Yes thats good but i want two second delay between each letter written, and going horizontally
Now, if our goal is to write this in portable C, then there is no way to write the sleep function. However, if you use Windows Specific functions, then I believe you can do it. Here is how:
#include <windows.h> #include <stdio.h> main() { printf("\n\nH"); Sleep( 2000 ); printf("e"); Sleep( 2000 ); printf("y"); printf( "\n" ); return 0; }
The argument to Sleep is the time in milliseconds. I hope this helps. Feel free to ask a follow up question. Bob -
/* IM TRYING TO WRITE IT SO THAT I CAN SEE EACH LETTER AS IT IS BEING WRITTEN BY THE COMPUTER*/ /* Thanks :doh: in advance*/ #include main() { printf("\n\nH"); sleep(2); printf("e"); sleep(2); printf("y"); sleep(2); return 0; } /* Im trying to run it one letter at a time*/
modified on Monday, March 9, 2009 8:30 PM
Assuming you want a 2ms delay (which is not discernable by the human eye) in between each letter, what you have is fine.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons