First guess my number program

Discussion in 'Programming General' started by IAmJerry, Jul 14, 2010.

First guess my number program
  1. Unread #1 - Jul 14, 2010 at 8:28 PM
  2. IAmJerry
    Joined:
    Jun 29, 2010
    Posts:
    214
    Referrals:
    0
    Sythe Gold:
    0

    IAmJerry Active Member

    First guess my number program

    Made it from scratch, that's why i am proud of it :).

    Made it in Microsoft Visual C++ 2010.

    Here it is

    Edit: Well that kinda sucks looking at it now, but, i made a calculator last night, don't feel like putting it here though :).


     
  3. Unread #2 - Jul 15, 2010 at 7:25 AM
  4. blindkilla
    Joined:
    Jun 22, 2005
    Posts:
    1,896
    Referrals:
    0
    Sythe Gold:
    6
    Discord Unique ID:
    282000633404456960
    Discord Username:
    sogord

    blindkilla Guru
    $25 USD Donor New

    First guess my number program

    Good work :D

    It doesn't suck, it's a great little program.

    Here are two little tips though for your code.

    Use a naming convention for variables. I prefer lower camel case, which is:
    Code:
    int theNumber;
    double myDoubleVariable;
    Second thing is, where you make a new line, you first use "\n", then everywhere after that you use "endl". Try to stick to using the same method, it makes your code cleaner and easier to read (especially in programs with a lot more code).
     
  5. Unread #3 - Jul 15, 2010 at 12:33 PM
  6. aznguy94
    Joined:
    Feb 11, 2007
    Posts:
    304
    Referrals:
    0
    Sythe Gold:
    0

    aznguy94 Forum Addict

    First guess my number program

    You use \n in quotations when you're already using " "

    examples...

    cout << myNum << endl;
    cout << "You guessed wrong\n";


    and why are you using float then int? just use int
     
  7. Unread #4 - Jul 15, 2010 at 2:01 PM
  8. IAmJerry
    Joined:
    Jun 29, 2010
    Posts:
    214
    Referrals:
    0
    Sythe Gold:
    0

    IAmJerry Active Member

    First guess my number program

    used float b/c the number could've been a non perfect number

    3.462

    int is for perfect numbers only if i am not mistaken.

    But besides that, i made a calc today, pretty proud of it :).
     
  9. Unread #5 - Jul 15, 2010 at 2:20 PM
  10. blindkilla
    Joined:
    Jun 22, 2005
    Posts:
    1,896
    Referrals:
    0
    Sythe Gold:
    6
    Discord Unique ID:
    282000633404456960
    Discord Username:
    sogord

    blindkilla Guru
    $25 USD Donor New

    First guess my number program

    You should post it too, I'm interested in seeing it.
     
  11. Unread #6 - Jul 21, 2010 at 12:19 AM
  12. aznguy94
    Joined:
    Feb 11, 2007
    Posts:
    304
    Referrals:
    0
    Sythe Gold:
    0

    aznguy94 Forum Addict

    First guess my number program

    Use double, not float; it stores a more reasonable amount of digits.
     
< Elementary C++ Conceptual Question | [Help] Decryption [Help] >

Users viewing this thread
1 guest


 
 
Adblock breaks this site