Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void uber(int **a,int n){
- int ch=0;
- for(int i=0;i<n;i++){
- for(int j=0;j<n;j++){
- ch+=1;
- a[i][j]=ch;
- }
- }
- }
- void print(int **a,int n){
- for(int i=0;i<n;i++){
- for(int j=0;j<n;j++){
- cout<<a[i][j]<<"\t";
- }
- cout<<endl<<endl;
- }
- }
- void transpose(int ** a, int n){
- int c=0;
- for(int i=0;i<n;i++){
- for(int j=0;j<n;j++){
- if (j < i){
- c=a[j][i];
- a[j][i] = a[i][j];
- a[i][j] = c;
- }
- }
- }
- }
- void table (int n ){
- for ( int i=1;i<n;i++){
- cout << endl;
- for (int j=1;j<n;j++){
- cout<<i<<" x "<<j<<" = "<<j*i<<endl;
- }
- }
- }
- int main()
- {
- int b=5;
- int **ptr = new int *[b];
- for ( int i=0; i<b; i++){
- ptr[i] = new int [b];
- for(int j=0;j<b;j++){
- ptr[i][j]=0;
- }
- }
- uber (ptr,b);
- print (ptr,b);
- cout << endl;
- transpose(ptr, b);
- print (ptr,b);
- table(b);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement