We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- C++
- STL
- Print Pretty
- Discussions
Print Pretty
Print Pretty
Sort by
recency
|
181 Discussions
|
Please Login in order to post a comment
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.
Can I sare a issue similer like this here?
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.
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.
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;