Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <windows.h>
- #include <iostream>
- #include <iomanip>
- #include <string>
- #include <stdlib.h>
- #include <math.h>
- #include <unistd.h>
- /*
- #include <vector>
- #include <utility>
- #include <time.h>
- #include <stdio.h>
- #include <fstream>
- #include <iterator>
- #include <algorithm>
- */
- ///////////////////////////////////
- using namespace std;
- //////////////////////////////////
- void print(int *, int, int);
- ////////////////////////////////////
- int main(int argc, char **argv)
- {
- // Руссификация сообщений
- system("chcp 1251 > nul");
- int r=1; int c=10;
- int *table = new int [10];
- for (int a= 0; a<10; a++) table[a]= a;
- NEXT:
- cout << "Линейный динамический массив" << endl;
- for (int a= 0; a<10; a++) cout << table[a] << "\t";
- cout << "Введите размерность массива" << endl;
- cout << "Строки= "; cin >> r;
- cout << "Колонки= "; cin >> c;
- if (r==0 || c==0) { delete [] table; return 0; }
- print(table, r, c);
- cout<<endl; system("pause"); system("cls");
- goto NEXT;
- cout<<endl; system("pause");
- return 0;
- }
- //////////
- void print(int *numbers, int rr, int cc)
- {
- for(int i =0; i < rr; i++)
- {
- for (int j = 0; j < cc; j++)
- {
- cout << numbers[i*cc+j] << "\t";
- }
- cout << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement