Run ❯
Get your
own
website
×
Change Orientation
Change Theme, Dark/Light
Go to Spaces
#include
#include
using namespace std; int main() { // Booleans cout << "Booleans\n"; cout << false << "\n"; cout << boolalpha << false << "\n"; // Hexadecimal and octal numbers cout << "\nHexadecimal and octal numbers\n"; int myInt = 14; cout << dec << myInt << "\n"; cout << hex << myInt << "\n"; cout << oct << myInt << "\n"; cout << showbase << uppercase; cout << hex << myInt << "\n"; cout << oct << myInt << "\n"; cout << dec; // Floating point numbers cout << "\nFloating point numbers\n"; float myFloat = 19.99; cout << myFloat << "\n"; cout << showpos << showpoint << 12345.0 << "\n"; cout << noshowpos << noshowpoint; cout << fixed << myFloat << "\n"; cout << scientific << myFloat << "\n"; // Alignment cout << "\nAlignment\n"; cout << setw(10) << left << "Left" << "\n"; cout << setw(10) << right << "Right" << "\n"; cout << setw(10) << internal << -12345 << " (Internal)\n"; return 0; }
Booleans
0
false
Hexadecimal and octal numbers
14
e
16
0XE
016
Floating point numbers
19.99
+12345.0
19.990000
1.999000E+01
Alignment
Left
Right
- 12345 (Internal)