Guest User

Untitled

a guest
Jan 24th, 2018
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. #include <stdio.h>
  2. #include<stdlib.h>
  3.  
  4. void nacitaj(double *a,double *b){
  5. scanf("%lf %lf\n",a,b);
  6. }
  7. double obsah(double a, double b){
  8. return ((a) * (b));
  9. }
  10. double obvod(double a, double b){
  11. return (2* ((a) + (b)));
  12. }
  13. double (*p_f)(double a, double b);
  14. int main (void){
  15. char c;
  16. double *a,*b;
  17. a=(double *) malloc(sizeof(double));
  18. b=(double *) malloc(sizeof(double));
  19. nacitaj(a,b);
  20. if ((c=getchar())=='s'){
  21. p_f=obsah;
  22. printf("%.3lf\n",p_f(*a,*b));
  23. }
  24. else if (c =='o'){
  25. p_f=obvod;
  26. printf("%.3lf\n",p_f(*a,*b));
  27. }
  28. getchar();
  29. getchar();
  30. return 0;
  31. }
Add Comment
Please, Sign In to add comment