janotte's Profile User Rating: *****

Reputation: 990 Master
Group:
Expert w/DIC++
Active Posts:
5,141 (1.77 per day)
Joined:
28-September 06
Profile Views:
32,193
Last Active:
User is offline Apr 26 2014 10:46 PM
Currently:
Offline

Previous Fields

Country:
AU
OS Preference:
Mac
Favorite Browser:
Who Cares
Favorite Processor:
Who Cares
Favorite Gaming Platform:
Who Cares
Your Car:
Who Cares
Dream Kudos:
25
Expert In:
C/C++

Latest Visitors

Icon   janotte is so tired of dumb old men being in charge of so much of the world

Posts I've Made

  1. In Topic: Using Classes

    Posted 24 Apr 2014

    Okay if I compile your code in the clang++ compiler and ask the compiler to tell me about all warnings ('-Wall') I get the following:

    clang++ -Wall dic.cpp
    dic.cpp:41:1: error: 'main' must return 'int'
    void main()
    ^~~~
    int
    dic.cpp:138:9: warning: assigning field to itself [-Wself-assign-field]
    pennies = pennies;
            ^
    1 warning and 1 error generated.
    
    


    Have a read here for how to get more warnings out of VS (I hope it is still current info for your version) http://blogs.msdn.co...n-visual-c.aspx

    So if I fix the void main() (along with providing a value in the 'return' in main()) and comment out the bad self assignment line then your code compiles with no messages and I get this output
    10002000300040000100110021003100410000101010201030104010011011102110311041100020102020203020402000011001200130014001010111012101310100003 1 1 2
    
    

    That doesn't immediately look silly but it is very hard to read.
    Perhaps if you search your code for 'cout' you will find some formatted output instructions your teacher supplied you that you might do well to copy????
  2. In Topic: Using Classes

    Posted 24 Apr 2014

    Show us exactly the code you are compiling.

    The stuff you showed us earlier has mistakes in it that I hope you have fixed before this stage so we need to see what you have now.

    What compiler are you using?
  3. In Topic: Using Classes

    Posted 24 Apr 2014

    View Postcozier, on 25 April 2014 - 03:14 PM, said:

    As far as the output, I want to output the new corrected total?


    Well that seems to be likely.
    And how will you get those values? (That's a hint by the way)
  4. In Topic: Using Classes

    Posted 24 Apr 2014

    If you want to test for the smallest number of coins required to make up change then one way (there are many) to do it would be like this.

    Get the total amount of money as pennies:
    pennies = pennies
    pennies = pennies + (nickels * 5)
    pennies = pennies + (dimes * 10)
    pennies = pennies + (quarters * 25)
    
    


    Now you want to run through the denominations from largest to smallest:
    quarters = pennies / 25
    pennies = pennies - (quarters * 25)
    dimes = pennies / 10
    pennies = pennies - (dimes * 10)
    nickels = pennies / 5
    pennies = pennies - (nickels * 5)
    
    


    Is that a rough idea that sparks better ones for you?

    EDIT : Sorry. Total brain failure in original post.
  5. In Topic: Using Classes

    Posted 24 Apr 2014

    View Postcozier, on 25 April 2014 - 01:45 PM, said:

    . . . do i need to just be saying something like
    if ( pennies ==5)
    {
     nickels++;
    }
    
    


    If you use '==' then it is only going to work when you have exactly 5 pennies. I am certain that is not what you want to test for.
    Wouldn't something more like seeing how many times you can divide the number of pennies by 5 is more like what you want?
    More like:
    nickels = pennies / 5;
    
    

    Remember if 'pennies' is a int then C++ will do integer math on the divide and discard the remainder.

    Does that make some sense?

My Information

Member Title:
code > sword
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Private
Website URL:
Website URL  http://

Comments

Page 1 of 1
  1. Photo

    yowzz28 Icon

    07 Oct 2013 - 23:46
    Hello Ma'am can you please help me in doing my Project :(( We need Just a simple payroll system . i've seen your post and you program well can you please help me to a simple payroll system :( Thanks a lot
  2. Photo

    chuajh Icon

    31 Mar 2011 - 19:41
    can u help me to answer this question?^^Thanks
    http://www.dreamincode.net/forums/topic/225366-computer-science-curriculum-question/page__p__1297885__fromsearch__1&#entry1297885
  3. Photo

    goldfish Icon

    27 Feb 2011 - 08:11
    Thank you. I was really getting confused. I'm going to work on it step by step as you suggested.
  4. Photo

    goldfish Icon

    26 Feb 2011 - 07:52
    Thank you so much for your help. I was so stuck and so depressed in the middle of night in the kitchen. Everyone asleep. Now you game me a direction, I will work on this today and I know I will come back with MORE prolblems. Yay!
  5. Photo

    taratatat Icon

    21 Jan 2011 - 00:16
    hi pwede po b manghingi ng sample ng information system using c++
  6. Photo

    janotte Icon

    12 Jan 2011 - 01:22
    It's not that I don't get comments left but usually they aren't very nice (because I am not very nice) so I delete them.
    Thanks for 'hi'.
  7. Photo

    Alex6788 Icon

    11 Jan 2011 - 16:48
    I don't see how you don't have any comments. I'll be the first to say hi.
Page 1 of 1