Advertisement
Guest User

Untitled

a guest
Jan 18th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. // ConsoleApplication2.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <iostream>
  6. #include <ctime>
  7. #include <string.h>
  8. #include <cstdio>
  9. #include <cstdlib>
  10.  
  11. using namespace std;
  12.  
  13. //Napisz funkcje void zamiana(int a, int b)
  14. //ktora zamienia wartosci parametrow
  15. //np :
  16. //przed a = 2, b = 5
  17. //po a = 5, b = 2
  18.  
  19. void zamiana(int a, int b)
  20. {
  21. cout << a << ' ' << b << endl;
  22. cout << "------" << endl;
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29. int *wsk;
  30. int *wski;
  31. wsk = &a;
  32. wski = &b;
  33. int przenosny = *wsk;
  34. *wsk = *wski;
  35. *wski = przenosny;
  36.  
  37.  
  38.  
  39.  
  40. cout << a << ' ' << b << endl;
  41.  
  42. }
  43.  
  44.  
  45.  
  46.  
  47.  
  48. int _tmain(int argc, _TCHAR* argv[])
  49. {
  50.  
  51. //int liczba1 = 4;
  52. //int liczba2 = 10;
  53. //int *wskI;
  54. //wskI = &liczba1;
  55. //cout << "adres: " << wskI << " wartosc: " << *wskI << endl;
  56. //wskI = &liczba2;
  57. //cout << "adres: " << wskI << " wartosc: " << *wskI << endl;
  58. //cout << "liczba2: " << liczba2 << endl;
  59. //*wskI = 30;
  60. //cout << "liczba2: " << liczba2 << endl;
  61. //system("pause");
  62. //return 0;
  63.  
  64. zamiana(20, 10);
  65.  
  66.  
  67.  
  68. system("Pause");
  69. return 0;
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement