Advertisement
Guest User

Untitled

a guest
Feb 19th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5.  
  6. int main() {
  7. double pay = 0, sum = 0, average = 0;
  8. int i = 1;
  9. double max;
  10. double min;
  11.  
  12. max = pay;
  13. min = pay;
  14.  
  15. cout << "Please enter a list of your spending: " << endl;
  16. cout << "Transaction #" << i++ << ": ";
  17. cin >> pay;
  18. while (pay != -9999) {
  19. sum += pay;
  20. pay += 1;
  21.  
  22. if (pay > max) {
  23. max = pay;
  24. }
  25. if (pay < min) {
  26. min = pay;
  27. }
  28. cout << "Transaction #" << i++ << ": ";
  29. cin >> pay;
  30. }
  31.  
  32. if (pay > -9999) {
  33. average = sum / pay;
  34. cout << "Minimum Number: " << "$" << min << endl;
  35. cout << "Maximum Number: " << "$" << max << endl;
  36. }
  37.  
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement