Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3.  
  4.  
  5. int main()
  6. {
  7. int rows, cols;
  8. std::cout << "Number of rows: ";
  9. std::cin >> rows;
  10. std::cout << "Number of columns: ";
  11. std::cin >> cols;
  12.  
  13. int** array = new int *[rows];
  14. for (int i = 0; i < rows; ++i)
  15. array[i] = new int[cols];
  16.  
  17. std::cout << "Enter\n";
  18. for (int i = 0; i < rows; i++)
  19. {
  20. for (int j = 0; j < cols; j++)
  21. {
  22. std::cin >> array[i][j];
  23. }
  24. }
  25.  
  26. std::cout << "Your array:" << std::endl;
  27. for (int i = 0; i < rows; i++)
  28. {
  29. for (int j = 0; j < cols; j++)
  30. {
  31. std::cout << array[i][j] << " ";
  32. }
  33. std::cout << "\n";
  34. }
  35. system("PAUSE");
  36. return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement