Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. C HELP PLEASE!! [modified]

C HELP PLEASE!! [modified]

Scheduled Pinned Locked Moved C / C++ / MFC
help
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    posidonofthecode
    wrote on last edited by
    #1

    /* 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

    B D 2 Replies Last reply
    0
    • P posidonofthecode

      /* 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

      B Offline
      B Offline
      BobInNJ
      wrote on last edited by
      #2

      I think this is what you want: #include <stdio.h> main() { printf("\n\nH"); printf("e"); ; printf("y"); printf( "\n" ); return 0; } Bob

      P 1 Reply Last reply
      0
      • B BobInNJ

        I think this is what you want: #include <stdio.h> main() { printf("\n\nH"); printf("e"); ; printf("y"); printf( "\n" ); return 0; } Bob

        P Offline
        P Offline
        posidonofthecode
        wrote on last edited by
        #3

        Yes thats good but i want two second delay between each letter written, and going horizontally

        B 1 Reply Last reply
        0
        • P posidonofthecode

          Yes thats good but i want two second delay between each letter written, and going horizontally

          B Offline
          B Offline
          BobInNJ
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          • P posidonofthecode

            /* 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

            D Offline
            D Offline
            David Crow
            wrote on last edited by
            #5

            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

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups