I need some help. My output is all wrong. I am trying to get output of cost of books purchased (will be different amounts according to category), sales tax due, total due, category and number of books purchased. I have only been doing C++ for about a month now and I am very green to say the least.
Code:# include <iostream> # include <iomanip> # include <cmath> using namespace std; char old; char new; char temporary; int main() { //declare variables char category; double costOfBooksPurchased; double salesTaxDue; double totalDue; int number_of_books_purchased; double oldBookPrice; double newBookPrice; double temporaryBookPrice; double bookPrice; cout << fixed << showpoint << setprecision (2); cout << "Enter the number of books purchased: "; cin >> number_of_books_purchased; cout << endl; cout << "Enter the category: old, new, temporary: "; cin >> category; cout << endl; number_of_books_purchased = number_of_books_purchased; category = old, new, temporary; if (number_of_books_purchased >=6) { temporaryBookPrice = number_of_books_purchased * 50; newBookPrice = number_of_books_purchased * 35; oldBookPrice = number_of_books_purchased * 20; } else { temporaryBookPrice = number_of_books_purchased * 45; newBookPrice = number_of_books_purchased * 30; oldBookPrice = number_of_books_purchased * 15; } bookPrice = temporaryBookPrice; bookPrice = newBookPrice; bookPrice = oldBookPrice; costOfBooksPurchased = number_of_books_purchased * bookPrice; salesTaxDue = costOfBooksPurchased * .04; totalDue = costOfBooksPurchased + salesTaxDue; cout << "The number_of_books_purchased = " << number_of_books_purchased << endl; cout << "The category = " << category << endl; cout << "The costOfBooksPurchased = $" << costOfBooksPurchased << endl; cout << "The salesTaxDue = $" << salesTaxDue << endl; cout << "The totalDue = $" << totalDue << endl; return 0; }