Thread: it is too fast......

  1. #1
    flashing vampire black's Avatar
    Join Date
    May 2002
    Posts
    563

    Unhappy it is too fast......

    Hi all~

    I am learning C++ step by step with my BCB, and I try to write some simple code under console mode, but the result splashed no more than half a second when running my code. how could I see it clearly ?
    Never end on learning~

  2. #2
    Registered User
    Join Date
    Mar 2002
    Posts
    12
    Hey I know it is not the most sophisticated way of doing it, but it does the job...

    Code:
    int main(void)
    {
       // you code here
    
       char c; cin>>c; //consoles waits for a char input before exiting.
       return 0;
    }
    hope that helps for now, but there are many other ways of doing it.

  3. #3
    i dont know Vicious's Avatar
    Join Date
    May 2002
    Posts
    1,200

    umm...

    put getchar() above return 0 and that will work.
    What is C++?

  4. #4
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    So that you don't have to include another header or create a new variable, just use get:
    Code:
      <snip the whole program>
      cin.get()
      return 0;
    }
    -Prelude
    My best code is written with the delete key.

  5. #5
    i dont know Vicious's Avatar
    Join Date
    May 2002
    Posts
    1,200
    yah that too...
    What is C++?

  6. #6
    Registered User billholm's Avatar
    Join Date
    Apr 2002
    Posts
    225

    Smile

    Just read a book That's what I did when I first started learning C. I had no programming experience prior to that. Now I code in C++ well

  7. #7
    i dont know Vicious's Avatar
    Join Date
    May 2002
    Posts
    1,200
    Yah right...
    Like us poor ppl are gonna pay 60$ for something they can find out here.

    What is C++?

  8. #8
    Registered User billholm's Avatar
    Join Date
    Apr 2002
    Posts
    225

    hehe...

    I did not buy any book. Just borrowed one I had no one to teach me too.

  9. #9
    flashing vampire black's Avatar
    Join Date
    May 2002
    Posts
    563

    Post

    Originally posted by billholm
    Just read a book That's what I did when I first started learning C. I had no programming experience prior to that. Now I code in C++ well
    I have 2 wonderful books, and it is a pity that I could not figure it out right now. thanx, guy~

    one of my book is Thinking in C++, I was sometimes confused when reading it, would it be suitable for beginners just like me ?
    Last edited by black; 05-12-2002 at 11:21 PM.
    Never end on learning~

  10. #10
    Registered User billholm's Avatar
    Join Date
    Apr 2002
    Posts
    225

    Talking

    Yes that's a good book, but some parts of it assume that you have prior knowledge to C.

    Try C++ Pimer (forgot the author) or The C++ Programming Language by Bjarne Stroustrup or any book that does not assume prior programming experience.


  11. #11
    i dont know Vicious's Avatar
    Join Date
    May 2002
    Posts
    1,200

    btw

    Black that is a nice Avatar.
    What is C++?

  12. #12
    Registered User billholm's Avatar
    Join Date
    Apr 2002
    Posts
    225

    Thumbs up Yep!

    Right!

  13. #13
    flashing vampire black's Avatar
    Join Date
    May 2002
    Posts
    563

    Arrow

    Originally posted by billholm
    Yes that's a good book, but some parts of it assume that you have prior knowledge to C.

    Try C++ Pimer (forgot the author) or The C++ Programming Language by Bjarne Stroustrup or any book that does not assume prior programming experience.

    yah~ I heard those 2 books before. I remember one of them have more than 1000 pages, right ? and the total would be 1800 pages or so, God~

    anyone could lend me time then ?
    Never end on learning~

  14. #14
    Registered User billholm's Avatar
    Join Date
    Apr 2002
    Posts
    225

    Talking Take it easy

    No no you don't have to read ALL of the pages

    Just use the books as your reference. Consult it if you have a few programming questions in mind then apply them to your codes

    That's what I did.

  15. #15
    Registered User
    Join Date
    Jan 2002
    Posts
    387
    if you don't want the user to have to press a key, and would rather have a delay, just include <windows.h> and use the Sleep(..) function:

    Code:
    #include <iostream>
    #include <windows.h>
    using namespace std;
    
    int main(int argc, char *argv[])
    {
         cout << "Hello World";
         Sleep(1000); // Sleep(Number Of Milliseconds);
         cout << "\n1 Second Delay!";
         Sleep(1000);
         return 0;
    }
    "There are three kinds of people in the world...
    Those that can count and those that can't."

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. fast image crop
    By stabu in forum C Programming
    Replies: 5
    Last Post: 04-23-2009, 03:07 PM
  2. Replies: 6
    Last Post: 02-27-2009, 04:43 PM
  3. Saving a part of screen into a file fast!
    By Zap in forum C++ Programming
    Replies: 4
    Last Post: 06-28-2003, 10:56 AM
  4. Super fast bilinear interpolation
    By VirtualAce in forum Game Programming
    Replies: 2
    Last Post: 06-18-2002, 09:35 PM
  5. moving a bitmap, fast and smooth
    By werdy666 in forum Game Programming
    Replies: 1
    Last Post: 05-31-2002, 06:49 PM