online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
/****************************************************************************** Welcome to GDB Online. GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby, C#, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS Code, Compile, Run and Debug online from anywhere in world. GS 25 Nov. 2020 regular enum test References: 1. https://stackoverflow.com/questions/8357240/how-to-automatically-convert-strongly-typed-enum-into-int 1. [my ans]https://stackoverflow.com/a/65014885/4561887 *******************************************************************************/ #include <iostream> #include <stdio.h> // enum class (AKA: "strong" or "scoped" enum) enum class my_enum { A = 0, B, C, }; // regular enum (AKA: "weak" or "C-style" enum) enum my_enum2 { MY_ENUM_A = 0, MY_ENUM_B, MY_ENUM_C, }; int main() { printf("Hello World\n"); // 1) scoped enum my_enum e = my_enum::A; // scoped through `my_enum::` e = my_enum::B; // int i = e; // NOT ALLOWED! // But this works fine: int i = static_cast<int>(e); // 2) regular enum my_enum2 e2 = MY_ENUM_A; // scoped through `MY_ENUM_` e2 = MY_ENUM_B; // This works fine! int i2 = e2; return 0; }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue