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.
  • 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:
  1. : Strip its decimal (i.e., truncate it) and print its hexadecimal representation (including the  prefix) in lower case letters.
  2. : 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.
  3. : Print it to a scale of exactly nine decimal places, expressed in scientific notation using upper case.

hackerrank print pretty problem solution in c++ programming

Print Pretty problem solution in C++ programming | HackerRank

#include <iostream>
#include <iomanip> 
using namespace std;

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;

        /* BEGIN: unlocked */
          // Sample solution:
            cout << left << hex << showbase << nouppercase;
            cout << (long long) A << endl;

            // One decimal place, right aligned, show sign, and fill left with underscores
            cout << showpos << fixed << setfill('_') << setw(15) << right;
            cout << B << endl;

            // Scientific notation with 9 decimal places
            cout << noshowpos << uppercase << scientific;
            cout << C << endl;
        /* END: unlocked */
    return 0;