This repository has been archived on 2024-12-16. You can view files and clone it, but cannot push or open issues or pull requests.
CodeBlocksPortable/WATCOM/samples/cplbexam/ios/setf.cpp

15 lines
423 B
C++

#include <iostream.h>
void main( void ) {
float num;
cout << "Enter a decimal number:" << endl;
cin >> num;
cout.setf( ios::floatfield );
cout.setf( ios::scientific, ios::fixed ); // scientific notation for output
cout << num << "(scientfic notation)" << endl;
cout.setf( ios::fixed, ios::scientific ); // floating notation for output
cout << num << "(floating notation)" << endl;
}