-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathhr18.cpp
43 lines (36 loc) · 973 Bytes
/
hr18.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <iostream>
#include <iomanip>
#include <string>
#include <math.h>
using namespace std;
string hex(int a) {
if (a <= 16) return to_string(a);
else {
string quo = to_string(a / 16);
int rem = a % 16;
return quo + hex(rem);
}
}
void process_a(double a) {
cout << left << "0x" + hex(int(a)) << endl;
}
void process_b(double b) {
cout << setfill('_') << setw(15) << showpos << right << b << endl;
}
void process_c(double c) {
cout << noshowpos << scientific << setprecision(9) << c << endl;
}
int main() {
int T; cin >> T;
cout << setiosflags(ios::uppercase);
cout << setw(0xf) << internal;
while(T--) {
double A; cin >> A;
double B; cin >> B;
double C; cin >> C;
cout << left << hex << showbase << nouppercase << long(A) << endl;
cout << fixed << showpoint << setfill('_') << setw(15) << showpos << setprecision(2) << right << B << endl;
cout << noshowpos << scientific << uppercase << setprecision(9) << C << endl;
}
return 0;
}