Print Pretty

Sort by

recency

|

172 Discussions

|

  • + 1 comment
    cout << hex << left << showbase << nouppercase;
            cout << (long long)A << endl;
    
            cout << dec << right << setw(15) << setfill('_') << showpos << fixed << setprecision(2);
            cout << B << endl;
    
            cout << scientific << uppercase << noshowpos << setprecision(9);
            cout << C << endl;
    
  • + 1 comment

    i need help it fails on test cases 6-9 which involves 1000 test cases. Here is my code.

    #include<bits/stdc++.h>
    using namespace std;
    
    
    int main() {
        int t;
        double a, b, c;
        int decimal=2;
        cin>> t;
        for(int i=0; i<t; i++){
            cin>>a>>b>>c;
            int truncated = static_cast<int>(a);
            cout<<"0x"<<hex<<nouppercase<<truncated<<endl;
            
            cout<<setw(15)<<setfill('_')<<showpos<<fixed
            <<setprecision(decimal)<<b<<endl;
            
            cout<<noshowpos                       
            <<scientific<<uppercase<<setprecision(9)<<c<<endl;
        }
    return 0;
    }
    
  • + 0 comments

    Use format library

  • + 0 comments

    This is my code and its passing testcase0 but its failing in other test cases so what is the issue

    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 a= static_cast(A); char hex[1000]; std::sprintf(hex,"%X",a); cout<

        string sign;
        if(B>=0){
            sign="+";
    
        }
        else{
            sign="-";
        }
        cout <<"_______"<<sign<<std::fixed<<std::setprecision(2)<<B<<endl;
    
          std::cout << std::scientific <<setprecision(9) <<C << std::endl;
    
    
    
    }
    return 0;
    

    }

  • + 0 comments

    Shittiest code what was that