Iomanip - cout<< total<<"\n\n" use two newline characters to skip line Display total with fixed precision cout<<"Total

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
// iomanip.cpp / #include <iostream.h> #include <iomanip.h> # int main() { double cost = 34.99; double total; total = cost + (cost * 0.07875); // add tax to cost to get total // Display total without formatting cout << "Total with no formatting:\n";
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: cout << total << "\n\n"; // use two newline characters to skip line // Display total with fixed precision cout << "Total with formatting:\n"; cout.setf(ios::fixed); cout << setprecision(2) << total << "\n\n"; return 0; }...
View Full Document

This note was uploaded on 06/20/2011 for the course COMPUTING 379 taught by Professor Dr.anoopsarkar during the Spring '11 term at American College of Computer & Information Sciences.

Ask a homework question - tutors are online