fork download
  1. ///////////////////////////////////////////////////
  2. // C++ versus printf (spoiler: C++ wins) //
  3. // (c) 2019 Andrey Kolobkoff <[email protected]> //
  4. ///////////////////////////////////////////////////
  5.  
  6. #include<iostream>
  7. #include<iomanip>
  8.  
  9. ///// FUUUU ////////////
  10. #include<cstdio>// FUUUU
  11. ////////////////////////
  12. ///TODO: delete, use C++
  13.  
  14. using namespace std;
  15.  
  16. int main(int nOfArguments, const char* Arguments [])
  17. {
  18.  
  19. //\\ ~ - --==# [ square equality's solution ] #==-- - ~ \\//
  20. double a=2;
  21. double b=3.5;
  22. double c=1.5;
  23. double D=b*b-4*a*c; //decrimenant's calculating
  24.  
  25. /////////---------------- skiping some code here ---------///////////////////
  26. //........................................
  27.  
  28. //\\ ~ - --==# [ C++ RULEZZZzZzZZzzz ] #==-- - ~ \\//
  29. //\\ flawles version, 1 LoC \\//
  30. std::cout << "decrimenant=" << std::fixed << std::setprecision(8) << D << std::endl << std::endl;
  31. //\\ end of C++ \\//
  32.  
  33. //\\ ~ - --==# [ printf @#$%@#%^!#@[email protected]#$ ] #==-- - ~ \\//
  34. //\\ dirty ugly %[email protected]#$&&$#% version, 5 LoC \\//
  35. //\\ FUUUUUUUUU /!\ DO NOT TRY REPEAT IT /!\ \\//
  36. printf("decrimenant=");
  37. //printf("%.8d", D); // decimal not ok, allways 0????? (PRINTF MUST DIE)
  38. double cel=int(D); double drob=int((D - cel) * 100000000);
  39. printf("%d.%08d", int(cel), int(drob));
  40. printf("\n");
  41. printf("\n");
  42. //\\ end of printf \\//
  43.  
  44. /////////---------------- skiping some code here ---------///////////////////
  45. //........................................
  46.  
  47. return a;//need return any thing
  48. }
  49.  
Runtime error #stdin #stdout 0s 15232KB
stdin
Standard input is empty
stdout
decrimenant=0.25000000

decrimenant=0.25000000