Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #define m 4
- using namespace std;
- void stampa(string A[m][m],int n)
- {
- string s[n];
- for(int i=0;i<n;i++)
- {
- for(int k=0;k<i+1;k++)
- {
- cout<<" " << A[k][i-k];
- s[k]=A[n-1-k][n-i-1+k];
- //cout<<" "<<A[n-1-k][n-i-1+k];
- }
- cout << endl;
- if(i!=(n-1))
- {
- for(int t=0;t<i+1;t++)
- {
- cout<<" "<<s[t];
- }
- cout << endl;
- }
- }
- }
- int main()
- {
- string A[m][m] =
- {{"ab","bc","cd","ef"},
- {"fg","gh","hi","jk"},
- {"ki","lm","mn","no"},
- {"op","pq","qr","rs"}};
- stampa(A,4);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement