Jun 27, 2015 at 7:20am UTC
can someone help me how to breakdown? sample
Enter the number : 7689
P1000 = 7
P500 = 1
P200 = 0
P100 = 1
P50 = 1
P20 = 1
P10 = 1
P5 = 0
P1 = 4
Last edited on Jun 27, 2015 at 7:21am UTC
Jun 27, 2015 at 7:52am UTC
It looks like you are to take a number and print out each place value by the listed increments? Can you post the code you have tried?
Jun 27, 2015 at 9:03am UTC
It seems like you want to make the number into cash, i guess the value of "p5" should be 1, could you show me your code or more details?
Jun 28, 2015 at 1:16am UTC
oh im sorry yes P5 is = 1
my sample code here
#include <conio.h>
#include <iostream.h>
int money, breakdown1, breakdown2;
void main()
{
clrscr();
cout<<"Enter the Amount of money : ";
cin>>money;
breakdown1 = money;
breakdown1 =money / 1000;
breakdown2 = money % 1000;
money = breakdown2;
cout<<"\nP1000 : = "<<breakdown1;
breakdown1 = money / 500;
breakdown2 = money % 500;
money = breakdown2;
cout<<"\nP500 : = "<<breakdown1;
breakdown1 = money / 200;
breakdown2 = money % 200;
money = breakdown2;
cout<<"\nP200 : = "<<breakdown1;
breakdown1 = money / 100;
breakdown2 = money % 100;
money = breakdown2;
cout<<"\nP100 : = "<<breakdown1;
breakdown1 = money / 50;
breakdown2 = money % 50;
money = breakdown2;
cout<<"\nP50 : = "<<breakdown1;
breakdown1 = money / 20;
breakdown2 = money % 20;
money = breakdown2;
cout<<"\nP20 : = "<<breakdown1;
breakdown1 = money / 10;
breakdown2 = money % 10;
money = breakdown2;
cout<<"\nP10 : = "<<breakdown1;
breakdown1 = money / 5;
breakdown2 = money % 5;
money = breakdown2;
cout<<"\nP5 : = "<<breakdown1;
breakdown1 = money / 1;
breakdown2 = money % 1;
money = breakdown2;
cout<<"\nP1 : = "<<breakdown1;
getch();
}
but when i put in Dev++ it will error
Jun 28, 2015 at 5:57am UTC
does DEV-C++ 5.11 is working? i tried it a lot but the error is #include <iostream.h> and i don't know why :< my codes is accurate and my friend tried too and it's working when i'm try it in Dev-C++ 5.11 it has error.