Advertisement
MrEfendi

Hard c++ laborki na wskaźnikach v2

Dec 7th, 2015
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.71 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. double a[10] = { 1,2,3,4,5,6,7,8,9,10 };
  6. double t2d[10][10];
  7.  
  8. void Display(int n, double *tab) {
  9.     double *granica = tab + n;
  10.     for (double *l_tab = tab ; l_tab < granica; l_tab++)
  11.     {
  12.         cout << *l_tab << " ";
  13.     }
  14.     cout << endl;
  15. }
  16.  
  17. void BackDisplay(int n, double *tab) {
  18.     for (double *l_tab = tab + n -1; l_tab >= tab; l_tab--)
  19.     {
  20.         cout << *l_tab << " ";
  21.     }
  22.     cout << endl;
  23. }
  24.  
  25. void Fill(int n, double *tab) {
  26.     int start = 5;
  27.     for (double *l_tab = tab; l_tab < tab + n; l_tab++)
  28.     {
  29.         *l_tab = start++;
  30.     }
  31. }
  32.  
  33. int main() {
  34.     double *wsk;
  35.     wsk = &t2d[0][0];
  36.  
  37.     Fill(100, wsk);
  38.  
  39.     Display(100, wsk);
  40.     BackDisplay(100, wsk);
  41.  
  42.     system("pause");
  43.     return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement