Print Pretty

Sort by

recency

|

183 Discussions

|

  • + 0 comments

    IIt helped me, Thank you so much.

  • + 1 comment

    Sicne they have included iomanip

    #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 */
            //find length of the B's realpart 
            long int temp = int(B);
            int digitCount=0;
            while(temp)
            {
                digitCount++;
                temp/=10;
            }
            //add 3 (. + 2decimal part)
            digitCount+=3;
            cout <<setw(0)<< showbase << hex <<nouppercase<< (long long) A<<endl;
            cout<<uppercase<<setw(0xf);
            cout << setw(15 - digitCount)<<setfill('_')<<'+'<<fixed<<setprecision(2)<<B<<endl;
            cout << scientific <<setprecision(9)<< C << endl;
            cout.precision();
            cout<< defaultfloat;
            
    	}
    	return 0;
    
    }
    
  • + 0 comments

    Rounding up the second input of each entry of three doubles is not occuring consistently. In test case two, the twelfth entry of three doubles, the second entry, 963.015, the expected output is __+963.01 which is not rounded up. However, then, in the 29th entry of three doubles, the second double entry is 218.895 with the expected output of __+218.90 which is rounded up. This shoudl be corrected or clarified.

  • + 0 comments

    Can I sare a issue similer like this here?

  • + 0 comments

    cout << left << hex << showbase << nouppercase << (long)A<< endl;

    cout << setw(0xf) << right << setfill('_') << showpos << setprecision(2) << fixed << B << endl;

    cout << scientific << uppercase << setprecision(9) << noshowpos << C << endl;

    HTH

    Thanks, --Sourav.