# Hacker Rank solution for Print Pretty In C++

Problem:- Print Pretty Hacker Rank Solution or Print Pretty hacker rank solution c++ or Print Pretty solution or Print Pretty solution in C++ or Print Pretty hacker rank solution in Java or Print Pretty hacker rank solution c++ or Print Pretty hacker rank solution c++ or Print Pretty program in c or Print Pretty solution in C or Hacker Rank Solution For Print Pretty in C++ or Print Pretty in C++ or Hacker Rank solution for Print Pretty in C++.

Check This- Hacker rank Solution for C++ Sub Domain Introduction, Classes, STL, Inheritance.

Output Format

For each test case, print 3 lines containing the formatted A, B, and C, respectively. Each A, B, and C must be formatted as follows:

A: Strip its decimal (i.e., truncate it) and print its hexadecimal representation (including the 0x prefix) in lower case letters.

B: Print it to a scale of 2 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 15 characters wide.

C: Print it to a scale of exactly nine decimal places, expressed in scientific notation using upper case.

Copy the full solution or colored code and paste into the hacker rank editor and click to Run Code if the code runs successfully then click to Submit Code. Before pasting the code into the editor make sure you have chosen c++ editor in the top right drop down option.

Solution:-

#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;

/* Enter your code here */
cout << resetiosflags(ios::uppercase|ios::scientific);
cout << std::setiosflags (ios::left|ios::fixed);
cout << setw(0) << std::hex;
cout << std::setiosflags (ios::showbase);
cout << (unsigned long)A << std::endl;

cout << resetiosflags(ios::showbase);
cout << setw(0xf) << setfill('_')<< std::dec ;
cout << setiosflags (ios::showpos) << setprecision(2);
cout  << B << endl;

cout << resetiosflags(ios::fixed|ios::showpos);
cout << setiosflags (ios::scientific | ios::uppercase) << setprecision(9);
cout << C << std::endl;

/*code ends here*/
}
return 0;
}

Output:-

1.Compilation With Custom Input

2. All Testcase's