Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #define N 101
- using namespace std;
- struct mat
- {
- char s,t;
- }A[N][N];
- char S[N], T[N];
- int n;
- void F(int n, char S[], char T[], mat A[][N])
- {
- int i,j;
- for(i=0;i<n;++i)
- for(j=0;j<n;++j)
- if(i==0) A[i][j].s=S[j];
- else
- if(j==0)A[i][j].s=A[i-1][n-1].s;
- else A[i][j].s=A[i-1][j-1].s;
- for(i=0;i<n;++i)
- for(j=0;j<n;++j)
- if(i==0) A[i][j].t=T[j];
- else
- if(j==n-1) A[i][j].t=A[i-1][0].t;
- else A[i][j].t=A[i-1][j+1].t;
- }
- void Afis(int n, mat A[][N])
- {
- int i,j;
- for(i=0;i<n;++i)
- {
- for(j=0;j<n;++j)
- cout<<'('<<A[i][j].s<<','<<A[i][j].t<<") ";
- cout<<'\n';
- }
- cout<<'\n';
- }
- int main()
- {
- cin>>n;cin.get();
- cin>>S>>T;
- F(n,S,T,A);
- Afis(n,A);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement