Guest User

Untitled

a guest
Mar 20th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. // description
  2. #include <iostream>
  3. #include <string>
  4. void inputArrayString(int row, int col , std::string ar[row][col]);
  5. int main()
  6. {
  7. using namespace std;
  8. const int Row = 3;
  9. const int Col = 4;
  10.  
  11. string list2[Row][Col];
  12. inputArrayString(Row, Col, list2);
  13. return 0;
  14. }
  15. void inputArrayString(int row, int col , std::string ar[row][col])
  16. {
  17. for (int r = 0; r < row; ++r)
  18. {
  19. for (int c = 0; c < col; ++c)
  20. getline(std::cin, ar[r][c]);
  21. std::cout << std::endl;
  22. }
  23. }
  24.  
  25. int main(int argc, char* argv[])
  26. {
  27. int stroch;
  28. int stolb;
  29. cin>>stroch;
  30. cin>>stolb;
  31. int **mass = new int*[stroch];
  32. for(int i = 0;i<stroch;i++){
  33. mass[i]= new int[stolb];
  34. }
  35. for(int i = 0; i<stroch;i++){
  36. for(int j = 0; j<stolb;j++){
  37. mass[i][j] = rand()%21 - 10;
  38. }
  39. }
  40. for(int i = 0; i<stroch;i++){
  41. for(int j = 0; j<stolb;j++){
  42. cout<<mass[i][j]<<"t";
  43. }
  44. cout<<"n";
  45. }
  46. for(int i=0; i<stroch;i++){
  47. delete[] mass[i];
  48. }
  49. delete[] mass;
  50. getch();
  51. }
Add Comment
Please, Sign In to add comment