fork download
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6. typedef int (*Func) (int, int);
  7. int test (int c, int b);
  8.  
  9. int main(int argc, char *argv[])
  10. {
  11. int c, b;
  12. cout << "\n Enter value c,b: \n";
  13. cout << ' ';
  14. cin >> c;
  15. cin >> b;
  16. Func func1;
  17. func1 = test;
  18. func1(c,b);
  19. }
  20.  
  21. int test (int c, int b){
  22. if (b>c)
  23. cout << b+c;
  24. else
  25. cout << c-b;
  26.  
  27. return 0;
  28. }
  29.  
Success #stdin #stdout 0s 4372KB
stdin
5 8
stdout
 Enter value c,b: 
 13