Print Pretty

Sort by

recency

|

181 Discussions

|

  • + 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.

  • + 0 comments

    Half this problem is not actually explained and some of it is actively hidden from you.

    the short of it is: 1 - You must use the iomanip functions on your cout. 2 - And pay attention to hidden code on lines 7 and 8, they change what you must do to print what they expect.

  • + 0 comments

    my answers are matched with test cases but can't passed the test cases

    include

    include

    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; int integer=A; int devident=integer;//100 int devisor=16; string hexa=""; string tempString=""; int length=0; int rem;
    while(devident) {
    int temp=devident/devisor; rem=devident%devisor; devident=temp; if(rem<10){ tempString=48+rem; hexa=tempString+hexa; } else{ tempString=87+rem; hexa=tempString+hexa;

            }
    
    
    
        }
        cout<<setw(0);
        cout<<"0x";
        cout << hexa <<endl;
        int in=B;
        double decimal=B-in;
        int third=(decimal*1000);
        third=third%10;
        int temp=decimal*100;
        if(temp==0)
        {   
    
            decimal=0.01;
        }
        if(third>=5)
        {
            temp++;
        }
        else if(temp<10)
        {  
            decimal=temp*0.001;
        }
        else{
            decimal=temp*0.01;
        }
        B=decimal+in;
        string prefix="";
        while(in>0)
        {
            in=in/10;
            length++;
            prefix+="_";
        }
            for(int i=0;i<11-length*2;i++)
            {
                prefix+="_";
            }
    
    
    
        if(B>0)
        {
            prefix+="+";
            cout<<prefix<<fixed<< setprecision(2)<<B<<endl;
    
        }
        else{
            prefix+="-"; 
              cout <<prefix<<fixed << setprecision(2)<<B<<endl;
        }
        ;
    
    
        cout <<scientific<<setprecision(9)<<C<<endl;  
        /* Enter your code here */
    }``