Advertisement
Guest User

Untitled

a guest
Sep 8th, 2015
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.02 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. int ****AllocationFunction(int &row, int &column)
  6. {
  7.     cout << "Input the amount of rows: ";
  8.     cin >> row;
  9.     cout << "\nInput the amount of columns: ";
  10.     cin >> column;
  11.  
  12.  
  13.  
  14.  
  15.     int**** s = new int***;
  16.     *s = new int**;
  17.     **s = new int*[row];
  18.  
  19.     int *t = ***s;
  20.     int ** v = **s;
  21.  
  22.     for (int i = 0; i < row; ++i)
  23.         (**s)[i] = new int[column];
  24.  
  25.  
  26.  
  27.  
  28.     //for (int row = 0; row < row; ++row)
  29.     //for (int column = 0; column < column; ++row)
  30.     //(*s)[row][column] = 0;
  31.  
  32.  
  33.     return s;
  34.  
  35. }
  36. void InputFunction(int ****s, int &row, int &column)
  37. {
  38. // ugly fix this
  39.     for (int i = 0, x = 0; i < column && x < row; i++)
  40.     {
  41.         cin >> (**s)[x][i];
  42.         cout << (**s)[x][i];
  43.         if (i == column - 1)
  44.         {
  45.             x++;
  46.             i = -1;
  47.         }
  48.  
  49.     }
  50. }
  51. void ReverseFunction()
  52. {
  53.  
  54. }
  55. void DisplayFunction()
  56. {
  57.  
  58. }
  59. void DeallocateFunction(string ***, size_t&)
  60. {
  61.  
  62. }
  63.  
  64. int main()
  65. {
  66.  
  67.     int row = 0;
  68.     int column = 0;
  69.  // is there a better way?
  70.     InputFunction(AllocationFunction(row, column),row, column);
  71.  
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement