Advertisement
andruhovski

prog-student

Feb 24th, 2016
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.77 KB | None | 0 0
  1. // ConsoleApplication2.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <math.h>
  6. void my_func(double *x, double *y);
  7. int _tmain(int argc, _TCHAR* argv[])
  8. {
  9.     double number_a = 3, number_b = 3;
  10.     printf("%lf %lf\n", number_a, number_b); // 3 4
  11.     my_func(&number_a, &number_b);
  12.     printf("%lf %lf\n", number_a, number_b); // 6 8
  13.     number_a =5, number_b = 4;
  14.     printf("%lf %lf\n", number_a, number_b); // 5 4
  15.     my_func(&number_a, &number_b);
  16.     printf("%lf %lf\n", number_a, number_b); // 25 16
  17.     return 0;
  18. }
  19.  
  20. void my_func(double *x, double *y)
  21. {
  22.     if (*x < *y)
  23.     {
  24.         *x = *x * 2;
  25.         *y = *y * 2;
  26.     }
  27.     else if (*x == *y)
  28.     {
  29.         *x = *y = 0;
  30.     }
  31.     else
  32.     {
  33.         *x = (*x) * (*x); //*x = pow(*x,2);
  34.         *y = (*y) * (*y); //*y = pow(*y,2);
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement