I just started classes for my college programming course, so I am a complete beginner. I want to align my decimals between my input and output phases. I can get my output phase all aligned, but the input phase is not lining up. Is there a way to ensure my decimals line up? I have added a picture to show the code and the line that I would like to align. (lines 16/17 to line up with lines 30-33). Thank you for any help you can provide. I am completely new to programming and am not even 100% sure of what I am doing, a lot of trial and error at this point.
Here is the code I have written so far:
#include <iomanip>
using namespace std;
int main()
{
//define variables
float number_books;
float cost_book;
float total_order;
float total_shipping;
float total_order_shipping;
// input phase
cout << "Enter number of books to order: ";
cin >> number_books;
cout << "Enter cost per book: $ ";
cin >> cost_book;
// process phase
total_order = number_books * cost_book;
if (total_order > 50)
total_shipping = 0;
else
total_shipping = 25.00f;
total_order_shipping = total_shipping + total_order;
// output phase
cout << setprecision(2) << fixed;
cout << "Book order total: $" << setw(8) << total_order << endl;
cout << "Shipping total: $" << setw(8) << total_shipping << endl;
cout << "Order & Shipping total:$" << setw(8) << total_order_shipping << endl;
system("pause");
return 0;
}