fork download
  1. //Ryan Shahriyarpour CS1A Carl Argila CH4 HW Q:2
  2. //
  3. /*****************************************************************************
  4.  *
  5.  * Book Club Points
  6.  *
  7.  *********************
  8.  *
  9.  * This program will give points to customers based on the amount of books they have bought
  10.  * 0 books = 0 points
  11.  * 1 book = 5 points
  12.  * 2 books = 15 points
  13.  * 3 books = 30 points
  14.  * 4 or more books = 60 points
  15.  *
  16.  * INPUT
  17.  * books : Number of books purchased
  18.  *
  19.  * OUTPUT
  20.  * points : Points awarded
  21.  *
  22.  ****************************************************************************/
  23.  
  24. #include <iostream>
  25. using namespace std;
  26.  
  27. int main()
  28. {
  29. int books;
  30. int points = 0;
  31.  
  32. cout << "Enter the number of books purchased this month: ";
  33. cin >> books;
  34.  
  35. if (books == 0)
  36. points = 0;
  37. else if (books == 1)
  38. points = 5;
  39. else if (books == 2)
  40. points = 15;
  41. else if (books == 3)
  42. points = 30;
  43. else if (books >= 4)
  44. points = 60;
  45.  
  46. cout << "Points awarded: " << points << "\n";
  47.  
  48. return 0;
  49. }
Success #stdin #stdout 0.01s 5284KB
stdin
Standard input is empty
stdout
Enter the number of books purchased this month: Points awarded: 60