better-enums/doc/tutorial/1-hello-world.md
2015-06-20 13:11:56 -05:00

657 B

Hello, World!

Download <a $download>enum.h, then compile this program:

#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 - a simple, but complete, Hello World program.