#include<iostream> #include<string> #include<vector> #include<set> #include<map> #include<iterator> #include<algorithm> #include<cctype> int main() { using namespace std; cout.setf(ios_base::left,ios_base::adjustfield); cout.setf(ios_base::showpos); cout.setf(ios_base::showpoint); cout.precision(3); ios_base::fmtflags old = cout.setf(ios_base::scientific,ios_base::floatfield); cout << "left just" << endl; long n; for (n = 1 ; n <= 41 ; n += 10) { cout.width(4); cout << n << "|"; cout.width(12); cout << sqrt(double(n)) << endl; } cout.setf(ios_base::right,ios_base::adjustfield); cout.setf(ios_base::fixed,ios_base::floatfield); for (n = 1 ; n <= 41 ; n += 10) { cout.width(4); cout << n << "|"; cout.width(12); cout << sqrt(double(n)) << endl; } return 0; }
时间: 2024-11-10 08:04:22