fork download
  1. // Marvyn De La Torre CS1A Chapter 4, P.222, #11
  2.  
  3. /**************************************************************
  4. * Calculate Book Club Points
  5. *
  6. * This program calculates the number of book club points earned
  7. * based on the number of books purchased.
  8. *
  9. * Input:
  10. * Number of books purchased = books
  11. *
  12. * Output:
  13. * Book club points earned = points
  14. **************************************************************/
  15.  
  16. #include <iostream>
  17. using namespace std;
  18.  
  19. int main()
  20. {
  21. int books, points;
  22.  
  23. cout << "Enter the number of books purchased: ";
  24. cin >> books;
  25.  
  26. if (books == 0)
  27. points = 0;
  28. else if (books == 1)
  29. points = 5;
  30. else if (books == 2)
  31. points = 15;
  32. else if (books == 3)
  33. points = 30;
  34. else
  35. points = 60;
  36.  
  37. cout << "Points earned: " << points << endl;
  38.  
  39. return 0;
  40. }
Success #stdin #stdout 0s 5320KB
stdin
3
stdout
Enter the number of books purchased: Points earned: 30