[ create a new paste ] login | about

Link: http://codepad.org/GYlMVYVy    [ raw code | output | fork ]

C++, pasted on Mar 2:
// Sandbox.cpp : Defines the entry point for the console application.
//

#include <iostream>

using namespace std;

enum pl_flag {
    PF_NULL = 0,
    PF_FIRST,
    PF_SECOND,
    PF_MAX,
    PF_ANDROID
};

bool my_traits[PF_MAX];
bool has_trait(int flag);

int main(int argc)
{
    int in;
    cout << "Is an android? : " << (has_trait(PF_ANDROID) ? "true" : "false");
    cin >> in;
    return 0;
}

bool has_trait(int flag)
{
    if (flag == PF_NULL) return true;
    return my_traits[flag];
}


Output:
1
Is an android? : false


Create a new paste based on this one


Comments: