Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Тобуляция:
- #include <iostream>
- using namespace std;
- void print(int**a,int m,int n){
- cout<<"matritsa:"<<endl;
- for (int i=0;i<n;i++)
- {
- for (int j=0;j<m;j++)
- cout<<a[i][j]<< "\t";
- cout<<endl;
- }
- }
- int main()
- {
- int** ptr= new int*[10];
- for (int i=0;i<10;i++) {
- ptr [i]=new int[10];
- for (int j=0;j<10;j++)
- ptr [i][j]=0;
- }
- print(ptr,10,10);
- }
- //Заполнение :
- #include <iostream>
- using namespace std;
- void print(int**a,int m,int n){
- cout<<"matritsa:"<<endl;
- for (int i=0;i<n;i++)
- {
- for (int j=0;j<m;j++)
- cout<<a[i][j]<< "\t";
- cout<<endl;
- }
- }
- void fill(int**a,int m,int n){
- int k=0;
- for (int i=0;i<n;i++){
- for (int j=0;j<m;j++){
- k+=1;
- a[i][j]=k;
- }
- }
- }
- int main()
- {
- int r=10;
- int** ptr= new int*[r];
- for (int i=0;i<r;i++) {
- ptr [i]=new int[r];
- for (int j=0;j<r;j++){
- ptr [i][j]=0;
- }
- }
- fill(ptr,10,10);
- print(ptr,10,10);
- }
- //Транспонирование матрицы:
- #include <iostream>
- using namespace std;
- void print(int**a,int m,int n){
- cout<<"matritsa:"<<endl;
- for (int i=0;i<n;i++)
- {
- for (int j=0;j<m;j++)
- cout<<a[i][j]<< "\t";
- cout<<endl;
- }
- }
- void fill(int**a,int m,int n){
- int k=0;
- for (int i=0;i<n;i++){
- for (int j=0;j<m;j++){
- k+=1;
- a[i][j]=k;
- }
- }
- }
- void st(int** a,int** p,int m,int n)
- {
- for (int i=0;i<n;i++)
- for (int j=0;j<m;j++)
- p[j][i]=a[i][j];\
- }
- int main()
- {
- ;
- int** ptr= new int*[10];
- int **new_ptr=new int*[10];;
- for (int i=0;i<10;i++) {
- ptr [i]=new int[10];
- new_ptr [i]=new int[10];
- for (int j=0;j<10;j++){
- ptr [i][j]=0;
- }
- }
- fill(ptr,10,10);
- print(ptr,10,10);
- st(ptr,new_ptr,10,10);
- print(new_ptr,10,10);
- }
Add Comment
Please, Sign In to add comment