{
}
Online Python Compiler
Online R Compiler
Online SQL Editor
Online HTML/CSS Editor
Online Java Compiler
Online C Compiler
Online C++ Compiler
Online C# Compiler
Online JavaScript Compiler
Online Typescript Compiler
Typescript Online Compiler
Online GoLang Compiler
Online Rust Compiler
Scala Online Compiler
Dart Online Compiler
Ruby Online Compiler
Online PHP Compiler
Online Swift Compiler
Generating Link
Generating Link
Share your code
Share code
Copy Link
Copied to clipboard
or share using
Black
66
%
Off
November
Stop copy pasting code you don't actually understand
Build the coding confidence you need to become a developer companies will fight for
Stop copy pasting code you don't actually understand
Become a PRO
Become a PRO
Black
66
%
Off
November
Stop copy pasting code you don't actually understand
Build the coding confidence you need to become a developer companies will fight for
Stop copy pasting code you don't actually understand
Become a PRO
Become a PRO
C++ Online Compiler
Learn Python App
Learn Python
main.cpp
Output
main.cpp
Share
Run
Run
#include <iostream> int main() { // 10 进制 int a = 123; std::cout << "10 进制: " << a << std::endl; // 8 进制 int b = 0123; // 0123 (八进制) = 8*8*1 + 8*2 + 3 = 64 + 16 + 3 = 83 (十进制) std::cout << "8 进制 (0123): " << b << std::endl; // 16 进制 int c = 0x1A; // 0x1A (十六进制) = 1*16 + 10 = 26 (十进制) std::cout << "16 进制 (0x1A): " << c << std::endl; // 类型后缀 long d = 123L; unsigned int e = 123U; unsigned long f = 123UL; std::cout << "带 L 后缀的 long 类型: " << d << std::endl; std::cout << "带 U 后缀的 unsigned int 类型: " << e << std::endl; std::cout << "带 UL 后缀的 unsigned long 类型: " << f << std::endl; // 演示类型后缀和不同进制的组合 unsigned long g = 0xFAUL; // 0xFA (十六进制) = 15*16 + 10 = 240 + 10 = 250 std::cout << "16 进制并带 UL 后缀: " << g << std::endl; return 0; }
Output
Clear