fork download
  1. #include <cstdio>
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7. printf("Hello World!\n");
  8.  
  9. printf("%d\n", 68);
  10. printf("Wynik to %d\n", 24);
  11.  
  12. string txt = "Hello World!";
  13. printf("%s\n", txt.c_str());
  14.  
  15. printf("%3d\n", 0);
  16. printf("%3d\n", 123456789);
  17. printf("%8d\n", -10);
  18.  
  19. printf("%-3d\n", 0);
  20. printf("%-3d\n", 123456789);
  21. printf("%-8d\n", -10);
  22.  
  23. printf("%03d\n", 0); // 000
  24. printf("%08d\n", 12); // 00000012
  25. printf("%02d:%02d\n", 14, 5); // 14:05
  26.  
  27. printf("%f\n", 12.85); // 12.850000
  28. printf("%.2f\n", 12.85); // 12.85
  29. printf("%.1f\n", 12.85); // 12.9
  30.  
  31. printf("%6.2f\n", 12.85); // 12.85
  32. printf("%06.2f\n", 12.85); // 012.85
  33. printf("%-6.2f\n", 12.85);
  34.  
  35. printf("%e\n", 5.65); // 5.650000e+00
  36. printf("%e\n", 5.653745343438343); // 5.653745e+00
  37. printf("%e\n", 4342342343245.0); // 4.342342e+12
  38.  
  39. printf("%+d\n", 5); // +5
  40. printf("%+d\n", -5); // -5
  41.  
  42. printf("%o\n", 127); // 177
  43. printf("%x\n", 127); // 7f
  44. printf("%X\n", 127); // 7F
  45.  
  46. return 0;
  47. }
Success #stdin #stdout 0.01s 5564KB
stdin
Standard input is empty
stdout
Hello World!
68
Wynik to 24
Hello World!
  0
123456789
     -10
0  
123456789
-10     
000
00000012
14:05
12.850000
12.85
12.8
 12.85
012.85
12.85 
5.650000e+00
5.653745e+00
4.342342e+12
+5
-5
177
7f
7F