Advertisement
Guest User

Untitled

a guest
Jul 17th, 2021
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. #include <windows.h>
  2. #include <iostream>
  3. #include <iomanip>
  4. #include <string>
  5. #include <stdlib.h>
  6. #include <math.h>
  7.  
  8. #include <unistd.h>
  9.  
  10. /*
  11. #include <vector>
  12. #include <utility>
  13. #include <time.h>
  14. #include <stdio.h>
  15. #include <fstream>
  16. #include <iterator>
  17. #include <algorithm>
  18. */
  19.  
  20. ///////////////////////////////////
  21.  
  22. using namespace std;
  23.  
  24. //////////////////////////////////
  25.  
  26.  
  27. void print(int *, int, int);
  28.  
  29. ////////////////////////////////////
  30.  
  31. int main(int argc, char **argv)
  32. {
  33. // Руссификация сообщений
  34.  
  35. system("chcp 1251 > nul");
  36.  
  37. int r=1; int c=10;
  38. int *table = new int [10];
  39. for (int a= 0; a<10; a++) table[a]= a;
  40.  
  41. NEXT:
  42. cout << "Линейный динамический массив" << endl;
  43. for (int a= 0; a<10; a++) cout << table[a] << "\t";
  44.  
  45. cout << "Введите размерность массива" << endl;
  46.  
  47. cout << "Строки= "; cin >> r;
  48. cout << "Колонки= "; cin >> c;
  49.  
  50. if (r==0 || c==0) { delete [] table; return 0; }
  51. print(table, r, c);
  52. cout<<endl; system("pause"); system("cls");
  53. goto NEXT;
  54.  
  55. cout<<endl; system("pause");
  56. return 0;
  57. }
  58. //////////
  59. void print(int *numbers, int rr, int cc)
  60. {
  61. for(int i =0; i < rr; i++)
  62. {
  63. for (int j = 0; j < cc; j++)
  64. {
  65. cout << numbers[i*cc+j] << "\t";
  66. }
  67. cout << endl;
  68. }
  69. }
  70.  
  71.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement