yay I made it all by myself

This is a discussion on yay I made it all by myself within the C++ Programming forums, part of the General Programming Boards category; It's a little short and pointless, but I'm happy I could make it and not ask any questions. Code: #include ...

  1. #1
    Registered User
    Join Date
    Dec 2004
    Posts
    465

    yay I made it all by myself

    It's a little short and pointless, but I'm happy I could make it and not ask any questions.

    Code:
    #include <iostream>
    
    using namespace std; 
    
    int main()
    {
      srand( (unsigned int) time (0));   
        
      for ( int x = rand()%20; x > 0; x-- ) {
          
        cout<< x <<endl;
      }
      cin.get();
    }
    My computer is awesome.

  2. #2
    Registered User
    Join Date
    Feb 2005
    Posts
    59
    Nice dude.

  3. #3
    former member Brain Cell's Avatar
    Join Date
    Feb 2004
    Posts
    472
    not nice. Function 'main()' should return a value .
    My Tutorials :
    - Bad programming practices in : C
    - C\C++ Tips
    (constrcutive criticism is very welcome)


    - Brain Cell

  4. #4
    Registered User Kybo_Ren's Avatar
    Join Date
    Sep 2004
    Posts
    136
    Actually, it doesn't have to.

  5. #5
    Registered User
    Join Date
    Feb 2005
    Posts
    59
    Oh yes. Didn't see that.

  6. #6
    former member Brain Cell's Avatar
    Join Date
    Feb 2004
    Posts
    472
    Quote Originally Posted by Kybo_Ren
    Actually, it doesn't have to.
    its 'int main()' not 'void main()' so it SHOULD return a value.
    My Tutorials :
    - Bad programming practices in : C
    - C\C++ Tips
    (constrcutive criticism is very welcome)


    - Brain Cell

  7. #7
    Registered User
    Join Date
    Mar 2003
    Posts
    580
    They're right that it should return a value, but otherwise it does what you want, and this is obviously one of your first programs, so I say keep up the good work
    See you in 13

  8. #8
    Registered User Kybo_Ren's Avatar
    Join Date
    Sep 2004
    Posts
    136
    Quote Originally Posted by Brain Cell
    its 'int main()' not 'void main()' so it SHOULD return a value.
    http://voyager.deanza.edu/~bentley/faq.htm

    EDIT for clarity: specifically, see #12.

  9. #9
    People Love Me
    Join Date
    Jan 2003
    Posts
    412
    Quote Originally Posted by Kybo_Ren
    Actually, it doesn't have to.
    Bad Kybo_Ren! Bad! No biscuit for you!

    main() should always return an int, silly boy.

  10. #10
    Registered User Kybo_Ren's Avatar
    Join Date
    Sep 2004
    Posts
    136
    Quote Originally Posted by Krak
    Bad Kybo_Ren! Bad! No biscuit for you!

    main() should always return an int, silly boy.
    No, main() does not have to return anything. It must specify int as its return type, but it doesn't have to return anything.

    See my above post. Another link: http://www.gamedev.net/community/for...age=1&#1825091

  11. #11
    Registered User
    Join Date
    Dec 2004
    Posts
    465
    I made a guessing game program there was a big post with my questions called randomizing?
    Any ideas on what kind of program I should make now? I'm making one just to make fun of my friend but thats not important.
    My computer is awesome.

  12. #12
    Registered User
    Join Date
    Jan 2005
    Posts
    7,340
    Where are the headers for srand, rand, and time?

  13. #13
    Registered User
    Join Date
    Dec 2004
    Posts
    465
    I don't know , but it worked anyway.
    My computer is awesome.

  14. #14
    Registered User
    Join Date
    Jan 2005
    Posts
    7,340
    On your machine, with your compiler, today. That's a bad habit to get into.

  15. #15
    Registered User
    Join Date
    Dec 2004
    Posts
    465
    I was just saying it worked I don't have a clue why.
    My computer is awesome.

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Small 3D Art Gallery I made
    By BobMcGee123 in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 07-06-2005, 06:03 PM
  2. nifty little thing i made
    By DavidP in forum C++ Programming
    Replies: 1
    Last Post: 12-05-2003, 10:43 PM
  3. Decompiler for *.exe made in c/c++
    By shagauravh in forum C Programming
    Replies: 7
    Last Post: 09-22-2001, 07:48 PM
  4. home made movies and animations
    By iain in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 09-02-2001, 11:16 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21