W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
#include
#include
using namespace std; int main() { // 布尔值 cout << "布尔值\n"; cout << false << "\n"; cout << boolalpha << false << "\n"; // 十六进制和八进制数 cout << "\n十六进制和八进制数\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; // 浮点数 cout << "\n浮点数\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"; // 对齐方式 cout << "\n对齐方式\n"; cout << setw(10) << left << "左对齐" << "\n"; cout << setw(10) << right << "右对齐" << "\n"; cout << setw(10) << internal << -12345 << " (内部对齐)\n"; return 0; }