1234567891011121314151617181920212223242526272829303132
#include <iostream> #include <iomanip> using namespace std; int main () { float bill; cout << "What is the total bill: $" ; // this portion defines what is displayed on the screen and what needs to be inputted cin >> bill; cout << fixed << setprecision(2); cout << "The recommend tip amounts are: " << endl << "10% = " << "$" << bill * .10 << endl << "15% = " << "$" << bill * .15 << endl << "20% = " << "$" << bill * .20 << endl << "25% = " << "$" << bill * .25 << endl << endl << "The total bill with the recommended tips are:" << endl << "10% = " << "$" << bill + bill * .10 << endl << "15% = " << "$" << bill + bill * .15 << endl << "20% = " << "$" << bill + bill * .20 << endl << "25% = " << "$" << bill + bill * .25 << endl; return 0; }
123456789101112131415161718192021222324252627282930313233
#include <iostream> #include <iomanip> using namespace std; int main() { float bill; cout << "What is the total bill: $"; // this portion defines what is displayed on the screen and what needs to be inputted cin >> bill; cout << fixed << setprecision(2); cout << "The recommend tip amounts are: " << endl; cout << "10% = " << "$" << setw(6) << bill * .10 << endl; cout << "15% = " << "$" << setw(6) << bill * .15 << endl; cout << "20% = " << "$" << setw(6) << bill * .20 << endl; cout << "25% = " << "$" << setw(6) << bill * .25 << endl; cout << "\n"; cout << "The total bill with the recommended tips are:" << endl; cout << "10% = " << "$" << setw(6) << bill + bill * .10 << endl; cout << "15% = " << "$" << setw(6) << bill + bill * .15 << endl; cout << "20% = " << "$" << setw(6) << bill + bill * .20 << endl; cout << "25% = " << "$" << setw(6) << bill + bill * .25 << endl; return 0; }
std::left
std::right