|
|
1.1 ! root 1: // exios106.cpp ! 2: // The setprecision manipulator ! 3: #include <iostream.h> ! 4: #include <iomanip.h> ! 5: ! 6: void main() ! 7: { ! 8: double values[] = { 1.23, 35.36, 653.7, 4358.24 }; ! 9: char *names[] = { "Zoot", "Jimmy", "Al", "Stan" }; ! 10: for ( int i = 0; i < 4; i++ ) ! 11: cout << setiosflags( ios::left ) ! 12: << setw( 6 ) ! 13: << names[i] ! 14: << resetiosflags( ios::left ) ! 15: << setw( 10 ) ! 16: << setprecision( 1 ) ! 17: << values[i] ! 18: << endl; ! 19: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.