Advertisement
High_Light

table umnozhenija

Nov 24th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.19 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void uber(int **a,int n){
  5.     int ch=0;
  6.     for(int i=0;i<n;i++){
  7.         for(int j=0;j<n;j++){
  8.             ch+=1;
  9.             a[i][j]=ch;
  10.         }
  11.     }
  12. }
  13.  
  14. void print(int **a,int n){
  15.     for(int i=0;i<n;i++){
  16.         for(int j=0;j<n;j++){
  17.             cout<<a[i][j]<<"\t";
  18.         }
  19.         cout<<endl<<endl;
  20.     }
  21. }
  22.  
  23. void transpose(int **a, int n){
  24.     int c;
  25.     for(int i=0;i<n;i++){
  26.         for(int j=0;j<n;j++){
  27.             if (j > i){
  28.                 c=a[j][i];
  29.                 a[j][i] = a[i][j];
  30.                 a[i][j] = c;
  31.             }
  32.         }
  33.     }
  34. }
  35.  
  36. void table1 (int n){
  37.     for (int i=1;i<n;i++){
  38.         cout << endl;
  39.         for (int j=1;j<n;j++){
  40.             cout<< i<< "*"<< j << "=" << i*j << "\t";
  41.         }
  42.     }
  43. }
  44.  
  45. int main()
  46. {
  47.     int b=11;
  48.     int **ptr = new int *[b];
  49.     for ( int i=0; i<b; i++){
  50.        ptr[i] = new int [b];
  51.        for(int j=0;j<b;j++){
  52.            ptr[i][j]=0;
  53.            }
  54.     }
  55.    // uber (ptr,b);
  56.    // print (ptr,b);
  57.    // cout << endl;
  58.    // transpose(ptr, b);
  59.    // print (ptr,b);
  60.    // cout << endl;
  61.     table1 (b);
  62.    // print (ptr,b);
  63.     cout << endl;
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement