Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4. int main()
  5. {
  6. int hugeAmount; //50 doodles
  7. int largeAmount; //25 doodles
  8. int mediumAmount; //10 doodles
  9. int smallAmount; //1 doodle
  10. int shippedDoodles; //total shipped
  11. int temp;
  12. cout<<"How many doodles were shipped?"<<endl;
  13. cin>>shippedDoodles;
  14. temp=shippedDoodles; //Assigns a temp value for calculations so
  15. //shipped can be displayed later
  16. while(temp>0)
  17. {
  18. if(temp-50>=0)
  19. {
  20. hugeAmount++;
  21. temp-=50;
  22. }
  23. else if (temp-25>=0)
  24. {
  25. largeAmount++;
  26. temp-=25;
  27. }
  28. else if(temp-10>=0)
  29. {
  30. mediumAmount++;
  31. temp-=10;
  32. }
  33. else if(temp-1>=0)
  34. {
  35. smallAmount++;
  36. temp-=1;
  37. }
  38. }
  39. cout<<temp<<endl; //To show the remaining amount
  40. cout<<hugeAmount<<endl; //Displays huge amount
  41. cout<<largeAmount<<endl; //Displays large amount
  42. cout<<mediumAmount<<endl; // Displays medium amount
  43. cout<<smallAmount<<endl; //Displays small amount
  44. system("pause");
  45. return 0;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement