Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ConsoleApplication2.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include <math.h>
- void my_func(double *x, double *y);
- int _tmain(int argc, _TCHAR* argv[])
- {
- double number_a = 3, number_b = 3;
- printf("%lf %lf\n", number_a, number_b); // 3 4
- my_func(&number_a, &number_b);
- printf("%lf %lf\n", number_a, number_b); // 6 8
- number_a =5, number_b = 4;
- printf("%lf %lf\n", number_a, number_b); // 5 4
- my_func(&number_a, &number_b);
- printf("%lf %lf\n", number_a, number_b); // 25 16
- return 0;
- }
- void my_func(double *x, double *y)
- {
- if (*x < *y)
- {
- *x = *x * 2;
- *y = *y * 2;
- }
- else if (*x == *y)
- {
- *x = *y = 0;
- }
- else
- {
- *x = (*x) * (*x); //*x = pow(*x,2);
- *y = (*y) * (*y); //*y = pow(*y,2);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement