Your manager gave you a text file with many lines of numbers to format and print. For each row of space-separated doubles, format and print the numbers using the specifications in the Output Format section below.
Input Format
The first line contains an integer, , the number of test cases.
Each of the subsequent lines describes a test case as space-separated floating-point numbers: , , and , respectively.
Constraints
- Each number will fit into a double.
Output Format
For each test case, print lines containing the formatted , , and , respectively. Each , , and must be formatted as follows:
- : Strip its decimal (i.e., truncate it) and print its hexadecimal representation (including the prefix) in lower case letters.
- : Print it to a scale of decimal places, preceded by a or sign (indicating if it's positive or negative), right justified, and left-padded with underscores so that the printed result is exactly characters wide.
- : Print it to a scale of exactly nine decimal places, expressed in scientific notation using upper case.
Sample Input
1
100.345 2006.008 2331.41592653498
Sample Output
0x64
_______+2006.01
2.331415927E+03
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <iomanip>
#include <cstdio>
#include <iostream>
using namespace std;
const int N = 700500;
const int inf = 0x3f3f3f3f;
int main()
{
int T;
scanf("%d", &T);
cout<<setiosflags(ios::uppercase);
cout<<setw(0xf)<<internal;
while(T--)
{
double A;
cin>>A;
double B;
cin>>B;
double C;
cin>>C;
cout<<setw(0)<<showbase << hex << nouppercase << long(A) << endl;
//setw(Number of characters to be used as field width.) hex 十六进制
//uppercase 大写 输出0X64 nouppercase 小写
cout << right << setfill ('_') << setw (15) << showpos << setprecision(2) << fixed << B << endl;
//setfill(The new fill character for the stream)常与setw连用
//showpos 有正负号, 0没有正负号
//noshowpos 正常输出,无正负号
cout << uppercase << noshowpos << setprecision(9) << fixed << scientific << C << endl;
//setprecision 保留有效位数
/*flag value effect when set
fixed write floating-point values in fixed-point notation
scientific write floating-point values in scientific notation.
(none) write floating-point values in default floating-point notation.
*/
}
}