fork download
  1. #include <iostream>
  2. using namespace std;
  3. enum class fruit;
  4. void printFruit(fruit f);
  5. enum class fruit: int {MANGO = 1,APPLE = 2};
  6. void printFruit(fruit f)
  7. {
  8. if(f == fruit::MANGO)
  9. cout<<"fruit is mango";
  10. else
  11. cout<<"fruit is apple";
  12. }
  13. int main() {
  14. fruit myfruit=fruit::MANGO;
  15. printFruit(myfruit);
  16. return 0;
  17. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
fruit is mango