35657

Untitled

Dec 26th, 2023
853
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.35 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int square(int* a) {
  6.     return *a *= *a;
  7. }
  8.  
  9. void Swap(int* x, int* y) {
  10.     int temp = *x;
  11.     *x = *y;
  12.     *y = temp;
  13. }
  14.  
  15. void Div(int* a) {
  16.     *a /= 2;
  17. }
  18.  
  19. int main() {
  20.     int a = 10;
  21.  
  22.     int b = 20;
  23.  
  24.     Swap(&a, &b);
  25.  
  26.     cout << a << endl;
  27.     cout << b << endl;
  28.  
  29.     int c = 30;
  30.     Div(&c);
  31.     cout << c << endl;
  32. }
  33.  
  34.  
Advertisement
Add Comment
Please, Sign In to add comment