Problem aligning text.
Hey everyone, I'm fairly new at C++, and I'm sure this is a simple error but I'd really appreciate some help. Here's my code :
1 2 3 4 5 6 7 8 9
|
cout<<fixed<<showpoint;
cout<<setprecision(2)<<"\nCost Copies:"<<setw(10) << costofcopies;
cout<<setprecision(2)<<"\nCost Stapling:"<<setw(8)<< costofstapling;
cout<<setprecision(2)<<"\nCost Total:" <<setw(11)<< totalcostofprintjob;
cout<<setprecision(2)<<"\nDiscount:" <<setw(13)<<totaldiscount;
cout<<setw(15)<< right << " \t \n=======" << setw(12);
cout<<setprecision(2)<<"\nCost Final :"<< setw(10)<< costfinal;
return 0;
|
my problem is with the second to last line the ======. They're not aligning underneath the rest of the numbers.
Last edited on
Try this:
1 2 3 4 5 6 7
|
cout << fixed <<showpoint<<setprecision(2);
cout << setw(15) << "Cost Copies:" << costofcopies <<"\n";
cout << setw(15) << "Cost Stapling:" <<costofstapling <<"\n";
cout << setw(15) << "Cost Total:" <<totalcostofprintjob <<"\n";
cout << setw(15) << "Discount:" <<totaldiscount <<"\n";
cout << setw(15)<<" "<<"===========\n";
cout << setw(15) << "Cost Final :" << costfinal <<endl;
|
Topic archived. No new replies allowed.