fork download
  1. #include <stdio.h>
  2.  
  3. enum MathOps {PLUS, MINUS, mosd};
  4.  
  5. float mathfunc(int x, enum MathOps operation, int y)
  6. {
  7. switch(operation){
  8. case PLUS: return x + y;
  9. break;
  10. case MINUS: return x - y;
  11. break;
  12. //etc.
  13. }
  14. }
  15. int main(void)
  16. {
  17.  
  18. printf("%f",mathfunc(4,PLUS,3));
  19.  
  20.  
  21. // your code goes here
  22. return 0;
  23. }
  24.  
Success #stdin #stdout 0s 2052KB
stdin
Standard input is empty
stdout
7.000000