Advertisement
nicuvlad76

Untitled

Dec 17th, 2020
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. #include <iostream>
  2. #define N 101
  3. using namespace std;
  4.  
  5. struct mat
  6. {
  7. char s,t;
  8. }A[N][N];
  9. char S[N], T[N];
  10. int n;
  11. void F(int n, char S[], char T[], mat A[][N])
  12. {
  13. int i,j;
  14. for(i=0;i<n;++i)
  15. for(j=0;j<n;++j)
  16. if(i==0) A[i][j].s=S[j];
  17. else
  18. if(j==0)A[i][j].s=A[i-1][n-1].s;
  19. else A[i][j].s=A[i-1][j-1].s;
  20.  
  21. for(i=0;i<n;++i)
  22. for(j=0;j<n;++j)
  23. if(i==0) A[i][j].t=T[j];
  24. else
  25. if(j==n-1) A[i][j].t=A[i-1][0].t;
  26. else A[i][j].t=A[i-1][j+1].t;
  27. }
  28. void Afis(int n, mat A[][N])
  29. {
  30. int i,j;
  31. for(i=0;i<n;++i)
  32. {
  33. for(j=0;j<n;++j)
  34. cout<<'('<<A[i][j].s<<','<<A[i][j].t<<") ";
  35. cout<<'\n';
  36. }
  37. cout<<'\n';
  38. }
  39.  
  40. int main()
  41. {
  42. cin>>n;cin.get();
  43. cin>>S>>T;
  44. F(n,S,T,A);
  45. Afis(n,A);
  46. return 0;
  47. }
  48.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement