Advertisement
MrEfendi

Hard c++ laborki na wskaźnikach

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