mirror of
https://github.com/aantron/better-enums.git
synced 2025-12-08 01:36:44 +08:00
24 lines
617 B
Markdown
24 lines
617 B
Markdown
## Hello, World!
|
|
|
|
Download <a $download><code>enum.h</code></a>, then build this program with it:
|
|
|
|
#include <iostream>
|
|
<em>#include "enum.h"</em>
|
|
|
|
<em>ENUM</em>(<em>Word</em>, <em>int</em>, <em>Hello</em>, <em>World</em>)
|
|
|
|
int main()
|
|
{
|
|
std::cout << <em>(+Word::Hello)._to_string()</em> << ", "
|
|
<< <em>(+Word::World)._to_string()</em> << "!"
|
|
<< std::endl;
|
|
|
|
return 0;
|
|
}
|
|
|
|
Run it, and you should see the output "Hello, World!"
|
|
|
|
Congratulations, you have just created your first Better Enum!
|
|
|
|
%% description = Introductory Better Enums tutorial.
|