Thread: newb help

  1. #1
    Registered User
    Join Date
    Jul 2007
    Posts
    8

    newb help

    Hello all.. I need a bit of help making sure I am going in the right direction on a simple program ..The compiler I am using is Dev-C++ 4.9.8.0.

    User types bolded information:

    Input the opening balance: 5000
    Input the amount of deposits: 3000
    Input the amount of withdrawals: 2000

    The opening balance: 5000
    The amount of deposits: 3000
    The amount of withdrawals: 2000
    = = = = =
    The closing balance: 6000

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    So, what is the direction that you have taken? Your calculations look good to me.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Jul 2007
    Posts
    8
    I need help writing a program that asks the user to enter the dollar amount of the opening balance of an account, the dollar amount of the deposits to the account, and the dollar amount of withdrawals from the account

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    I need help writing a program that asks the user to enter the dollar amount of the opening balance of an account, the dollar amount of the deposits to the account, and the dollar amount of withdrawals from the account
    I can see that. I can also tell that you have not read about our Homework Policy.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #5
    Registered User
    Join Date
    Jul 2007
    Posts
    8
    How long would it take you to write this program?

  6. #6
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    ROFL!

    It would probably take laserlight under 5 minutes (we're probably talking seconds, not minutes).

  7. #7
    Registered User
    Join Date
    Jul 2007
    Posts
    8
    Wow I'm impressed! Thanks anyway..

  8. #8
    Registered User
    Join Date
    Jun 2007
    Posts
    1
    Well you'd need to declare your 3 variables (total (we'll call the amount you first put in the account total), deposited, and withdrawn), as integers (if they're values like your examples), or floats (if they're values with decimals, currency usually is). You'd need to take the total input from the user first, take the deposit input and add that, and then take the withdrawn input and subtract that. Then simply print your total variable.

  9. #9
    Registered User
    Join Date
    May 2006
    Posts
    903
    Quote Originally Posted by MacGyver View Post
    ROFL!

    It would probably take laserlight under 5 minutes (we're probably talking seconds, not minutes).
    Definitely, we're talking about seconds.

    We're not going to spit out the answer for you. Try it, tell us what went wrong or what you don't understand and then we'll help you if we judge you tried hard enough.

  10. #10
    Registered User
    Join Date
    Jul 2007
    Posts
    8
    Okay no problem, I will post what I have so far when I get off work

  11. #11
    Captain - Lover of the C
    Join Date
    May 2005
    Posts
    341
    Quote Originally Posted by surfking View Post
    How long would it take you to write this program?
    Timed myself: 136 seconds (2 min 16 sec)
    Don't quote me on that... ...seriously

  12. #12
    Registered User
    Join Date
    May 2006
    Posts
    903
    Ouch, it hurts. It took me an amazing 4:20... I made a stupid mistake and needed to rewrite a good part of the code =/ What a shame.

  13. #13
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Now, this sounds like a real Challenge in C++
    Took me just under 100 seconds, but I cheated with copy/paste of the text
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  14. #14
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    Took me 00:05:30.110 to write it out, test it, and guarentee it worked, in addition to making the format all pretty looking. Java messed me up and I was using + instead of << to print the variables (No, I can never remember what language I'm using.).

    Interesting output, though. lol....

    Edit: Redid the basics of the program in C in 00:02:23.609 without worrying as much about formatting.
    Last edited by MacGyver; 07-08-2007 at 01:09 PM.

  15. #15
    Registered User
    Join Date
    Jan 2006
    Location
    Sweden
    Posts
    92
    I did it in about 116 seconds, but I too used copy and paste
    Now that I've answered the standing question, I feel like writing something meanful.
    To thread creator: check this awesome page out: http://www.cprogramming.com/tutorial.html

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Newb Question Character Counting
    By Wilder in forum C Programming
    Replies: 13
    Last Post: 06-22-2008, 11:37 PM
  2. Dogpile the newb!
    By lindy in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 05-23-2008, 08:17 AM
  3. Total newb directx invisable geometry question
    By -pete- in forum Game Programming
    Replies: 5
    Last Post: 08-13-2006, 01:45 PM
  4. Newb C++ Programmer
    By Philandrew in forum C++ Programming
    Replies: 8
    Last Post: 10-19-2004, 08:44 PM
  5. if your not newb you can help me
    By Klinerr1 in forum C++ Programming
    Replies: 6
    Last Post: 05-05-2002, 12:09 AM