help with simple program

This is a discussion on help with simple program within the C++ Programming forums, part of the General Programming Boards category; Hi, this is my first time posting and I have searched though the site but cannot find the answer to ...

  1. #1
    Registered User
    Join Date
    Dec 2009
    Posts
    1

    help with simple program

    Hi,
    this is my first time posting and I have searched though the site but cannot find the answer to the question that I have.

    the question is

    Write a program that makes change for the amount of change a user inputs.
    Now they want this done using mulyiple if statements and I have to input the money in cents and output in coins and bills
    so if a person enters 58 cents I should get the output of 2 quarters, 1 nickel, 3 cents. so it cannot say 0 dimes etc..

    has anyone done this one before or can anyone throw me a bone on how to get this started.

    thanks a bunch for your time

    Mark

  2. #2
    Registered User
    Join Date
    Jan 2005
    Posts
    7,317
    What do you have so far? We don't do homework assignments for people. Instead we help with specific questions. A good idea would be for you to post your best attempt and point out something specific that you are having trouble with.

    At the very least, you should be able to make a simple program that requests the input from the user and saves it in a variable. I'd do that first, and see if it works (add test code to output the variable just to be sure it runs correctly).

    Once you get that working, then give the meat of the assignment a try. Maybe start with outputting how many dollar bills would be in the answer. Again, make sure your attempt compiles and runs and gives correct output, then continue. If you get stuck on any step, post the code, the compiler errors (if any) and/or the output you expect and what you are getting instead. You'll get lots of help that way.

  3. #3
    Registered User
    Join Date
    Jan 2005
    Posts
    7,317
    pelicanpie, please don't post attempted solutions to homework.

    See the homework policy.
    Last edited by Daved; 12-14-2009 at 05:19 PM.

  4. #4
    Ex scientia vera
    Join Date
    Sep 2007
    Posts
    478
    Quote Originally Posted by pelicanpie View Post
    shut up
    Intelligent reply. Really.

    Read the link he posted. He was just being polite. If you fail to comply you'll probably get banned.
    "What's up, Doc?"
    "'Up' is a relative concept. It has no intrinsic value."

  5. #5
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,537
    Quote Originally Posted by pelicanpie View Post
    shut up
    Such attitude does indeed warrant a ban.
    If you disagree with Daved, then post your reasons and feel free to discuss ut (although perhaps via PM). But outright bad attitude is not someone we would want on a forum. Real word etiquette applies here too, you know!
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  6. #6
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,589
    pelicanpie, just take the recommendation graciously. It is not against the letter of the rules to post working programs that directly answer homework questions, but it is against the spirit of the homework policy, since it encourages failure to follow that policy.

    As such, I certainly have no intention of banning you for your post #3, especially since a reader still needs to do a little work to turn it into a program, but your post #5 comes close to breaking rules #6 and #7 of the forum guidelines.

    So, just let it be, and move on. Next time you can be a little more careful when handing out so complete a code snippet.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  7. #7
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,537
    Then, if this is a homework, does whoaha deserve to complete the course?
    And if it is not a homework question, then perhaps whoaha should study the basics of the language a little more and we could carefully guide whoaha so that whoaha actually learns the basics?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  8. #8
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,589
    Quote Originally Posted by pelicanpie
    But what if whoha is too dumb to come up with a solution on his own?
    He/she only made that initial post in this thread and did not post an attempt; give him/her the benefit of the doubt that he/she can actually do it, or at least make a very good attempt, with a little prodding.

    Once there is a reasonable attempt, it becomes reasonable to post more complete solutions that demonstrate improvements on the attempt (but I would still suggest doing it in moderation, or to continue posting small snippets to demonstrate improvements, otherwise you may deprive the learner the experience of arriving at a complete and pretty good solution on his/her own).
    Last edited by laserlight; 12-15-2009 at 12:22 PM.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  9. #9
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,589
    Quote Originally Posted by pelicanpie
    Who here thinks that we should ban Elysia?
    You really don't get it, do you? I am trying not to derail this thread further, that's why I told you to move on. Do it.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  10. #10
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,589
    whoha, as Daved suggested in post #4, read the homework policy. I suggest that you make an attempt at solving the problem. Once you have done so, compare your attempt with pelicanpie's example in post #3. If you have trouble understanding that example, or if you wish to get an evaluation of your attempt, or otherwise still need help, start a new thread, and remember to post your attempt and how does it not work.

    *thread closed*
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help with a very simple program
    By htdefiant in forum C++ Programming
    Replies: 13
    Last Post: 08-14-2007, 01:27 PM
  2. Using variables in system()
    By Afro in forum C Programming
    Replies: 8
    Last Post: 07-03-2007, 12:27 PM
  3. [Help] Simple Array/Pointer Program
    By sandwater in forum C Programming
    Replies: 3
    Last Post: 03-30-2007, 02:42 PM
  4. simple silly program
    By verbity in forum C Programming
    Replies: 5
    Last Post: 12-19-2006, 05:06 PM
  5. fopen();
    By GanglyLamb in forum C Programming
    Replies: 8
    Last Post: 11-03-2002, 11:39 AM

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