Guest User

Untitled

a guest
Sep 9th, 2015
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.71 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. void AllocationFunction(int ****&s, int *&t, int *&v, int **&u, int &row, int &column)
  6. {
  7.  
  8.  
  9.     s = new int***;
  10.     *s = new int**;
  11.     **s = new int*[row];    
  12.     u = new int*;
  13.  
  14.  
  15.     while (row < 2)
  16.     {
  17.         cout << "How many rows should the array have <at least 2> --> ";
  18.         cin >> row;
  19.  
  20.         if (row >= 2 && column < 2)
  21.         {
  22.             cout << "How many columns should the array have <at least 2> --> ";
  23.             cin >> column;
  24.         }
  25.     }
  26.    
  27.  
  28.     for (int i = 0; i < row; ++i)
  29.         (**s)[i] = new int[column];
  30.  
  31. }
  32.  
  33. void InputFunction(int ****&s, int *t, int *v, int **u, int &row, int &column)
  34. {
  35.     for (int i = 0, x = 0, z = 1; i < column && x < row; i++)
  36.     {
  37.         if (i == 0)
  38.          cout << "\nFor row " << z << " enter " << column << " values seperate by spaces --> ";
  39.  
  40.         cin >> (*(*(**s + x) + i));
  41.  
  42.         if (i == column - 1)
  43.         {
  44.             z++;
  45.             x++;
  46.             i = -1;
  47.         }
  48.  
  49.        
  50.     }
  51. }
  52.  
  53. void ReverseFunction(int ****s, int *t, int *v, int **u, int row, int column)
  54. {
  55.    
  56. }
  57.  
  58. void DisplayFunction(int ****s, int *t, int *v, int **u, int row, int column)
  59. {
  60.    
  61.         for (int i = 0; i < column; i++)
  62.         {
  63.             cout << **s[0][i];
  64.  
  65.         }
  66. }
  67.  
  68. void DeallocateFunction(int ****s, int *t, int **v)
  69. {
  70.  
  71. }
  72.  
  73. int main()
  74. {
  75.  
  76.     int row = 0;
  77.     int column = 0;
  78.  
  79.     int**** s = nullptr;
  80.     int * t = nullptr;            
  81.     int ** u = nullptr;
  82.     int * v = nullptr;
  83.  
  84.  
  85.     AllocationFunction(s, t, v, u, row, column);
  86.     InputFunction(s, t, v, u, row, column);
  87.     DisplayFunction(s, t, v, u, row, column);
  88.     //ReverseFunction(s, t, v, u, row, column);
  89.     //DisplayFunction(s, t, v, u, row, column);
  90.     //DeallocateFunction(s, t, u, v);
  91.  
  92.     //ReverseFunction(InputFunction(AllocationFunction(s, t, v, row, column),row, column),row, column);
  93.  
  94. }
Advertisement
Add Comment
Please, Sign In to add comment