Skip to content

Instantly share code, notes, and snippets.

@mattsegura
Created December 1, 2020 22:53
Show Gist options
  • Save mattsegura/7676d626e47f7f134394d8815e2ebcb5 to your computer and use it in GitHub Desktop.
Save mattsegura/7676d626e47f7f134394d8815e2ebcb5 to your computer and use it in GitHub Desktop.
bookcal
// book discounts
#include <iostream>
using namespace std;
int main()
{
const double book_price = 5.00;
// Variables
int books, original_price;
cout << "\nEnter the amount of books sold: ";
cin >> books;
original_price = book_price * books;
if (original price >= 0 && <= 4)
{
cout << "Total cost for " << books
<< " books = $" <<
(original_price - (original_price * .2)) << endl; // 5 percent
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment