Lab3

Lab3 - //Example: setprecision, fixed, showpoint #include

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: //Example: setprecision, fixed, showpoint #include <iostream> #include <string> #include <iomanip> using namespace std; int main() { double x,y,z; float A = 9 ; string Temp = "Hello"; x = 15.673; y = 235.736; z = 9525.9864765; cout << "\n\t\tNo format: \n\n" ; cout<<" x = "<<x<<endl; cout<<" y = "<<y<<endl; cout<<" z = "<<z<<endl; cout << " A = " << A << endl ; cout << "press enter to continue: " ; cin.get(); cout <<"\n\t\tUsing scientific only : \n\n" ; cout<< scientific ; cout<<" x = "<<x<<endl; cout<<" y = "<<y<<endl; cout<<" z = "<<z<<endl; cout << " A = " << A << endl ; cout << "press enter to continue: " ; cin.get(); cout <<"\n\t\tUsing fixed only : \n\n" ; cout<<fixed ; cout<<" x = "<<x<<endl; cout<<" y = "<<y<<endl; cout<<" z = "<<z<<endl; cout << " A = " << A << endl ; cout << "press enter to continue: " ; cin.get(); cout <<"\n\t\tUsing fixed, showpoint(to show the trailing 0's), \n\t\t\tshowpos (to show + sign): \n\n" ; cout <<showpoint<< showpos ; cout<<" x = "<<x<<endl; cout<<" y = "<<y<<endl;...
View Full Document

Page1 / 2

Lab3 - //Example: setprecision, fixed, showpoint #include

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online