| | |
d.s. malik
Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Oct 2009
Posts: 24
Reputation:
Solved Threads: 0
0
#5 Nov 7th, 2009
progrmming statments r difficult for me i dont know what i ve done in this progrme there r many but here it is
a cashier has currency notes of denomination 10,50,100. if the amount to be withdrawn is input through the keyboard in hunderds, find the total number of currency notes of each denomination the cashier will have to give the withdrawer??
n what do u mean by provide code??
a cashier has currency notes of denomination 10,50,100. if the amount to be withdrawn is input through the keyboard in hunderds, find the total number of currency notes of each denomination the cashier will have to give the withdrawer??
n what do u mean by provide code??
3
#6 Nov 7th, 2009
>so tell me when u ll start to learn me ???????? i m wating
I'll learn you good. Start by not being so impatient. Everyone has to start from nothing and work their way up to something. Being given solutions doesn't help you learn nearly as much as working your way through to your own solution.
>n what do u mean by provide code??
He means try it first on your own before begging for help. I can guarantee that when (or if) you get into the real world as a programmer and try that BS, you'll be told to do your damn job and stop whining.
I'll learn you good. Start by not being so impatient. Everyone has to start from nothing and work their way up to something. Being given solutions doesn't help you learn nearly as much as working your way through to your own solution.
>n what do u mean by provide code??
He means try it first on your own before begging for help. I can guarantee that when (or if) you get into the real world as a programmer and try that BS, you'll be told to do your damn job and stop whining.
New members chased away this month: 5
•
•
Join Date: Oct 2009
Posts: 24
Reputation:
Solved Threads: 0
0
#8 Nov 7th, 2009
C++ Syntax (Toggle Plain Text)
#include <iostream> using namespace std; int main() { int note10,note50,note100; cout<<"enter the withdrawn ammount" cin>>amount;
0
#9 Nov 7th, 2009
Here is the pseudo code for what ye' wish to accomplish:
1. Accept user input in the proper format. In this case, since we are dealing with money, I would suggest a 'double' data type or something comparable that will handle decimal values. (if you want to deal with only whole dollar amounts, be sure to let the user know)
2. Now that you have the user input, try using simple division to determine what denominations of money is to be 'returned' to the user. I would start testing with the largest denomination possible... then when that no longer works, then you can start trying lower denominations (based on real-life cashiering logic).
This should get ye' pointed in some sort of direction.
This is untested/uncompiled code and may contain simple easy to fix errors.
1. Accept user input in the proper format. In this case, since we are dealing with money, I would suggest a 'double' data type or something comparable that will handle decimal values. (if you want to deal with only whole dollar amounts, be sure to let the user know)
2. Now that you have the user input, try using simple division to determine what denominations of money is to be 'returned' to the user. I would start testing with the largest denomination possible... then when that no longer works, then you can start trying lower denominations (based on real-life cashiering logic).
C++ Syntax (Toggle Plain Text)
//This is your lowest denomination, so when we get to this point, we know we don't need to continue to calculate change with this loop. while(change < 10) { //Test for your largest denomination first if(amount / 100) { //adjust user inputed amount to withdraw amount -= 100; //keep a running counter of how many $100 bills ye' have issued thus far hundreds++; } else if(amount / 50) { amount -= 50; fifties++ } ... ... ... etc etc. cout << "You get " << hundreds << " x $100" <<endl; cout << "You get " << fifties << " x $50"<<endl; cout << "You get " << tens << " x $10" <<endl; cout << "Remaining money: $" << amount;
This should get ye' pointed in some sort of direction.
This is untested/uncompiled code and may contain simple easy to fix errors.
Last edited by Clinton Portis; Nov 7th, 2009 at 4:42 pm.
0
#10 Nov 8th, 2009
I guess all the solutions of the exercises of CHAP2 .. CHAP 5 are there at the appendix section of the book, if you do not find it there , just write a letter to the author of the book, he will oblige by sending you the answers via mail.
![]() |
Similar Threads
- How to Handle Images in Datagrid by using c# ??? (C#)
- Hey im Ayaz Malik (Community Introductions)
- Question on Book (C++)
- bubble sort function w/ array (C++)
- Segmentation Fault error (C)
- Inspiron 8100 (Dell) LCD and external monitor showing only odd color lines all over (Monitors, Displays and Video Cards)
- comparing strings (newbie question) (C)
Other Threads in the C++ Forum
- Previous Thread: Can functions that return int, take files as parameters.
- Next Thread: Reverse digit array
Views: 415 | Replies: 9
| Thread Tools | Search this Thread |
Tag cloud for C++
6 api application array arrays assignment beginner binary bitmap c++ c/c++ calculator char class classes code coding compile compiler console conversion convert count data database delete developer display dll email encryption error file forms fstream function functions game generator getline givemetehcodez graph homeworkhelper iamthwee ifstream image input int java lazy lib loop looping loops map math matrix memory multidimensional multiple newbie news node number output parameter pointer problem program programming project proxy python random read recursion recursive reference return sort sorting string strings struct template templates text tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






