Advertisement
Guest User

adg

a guest
Nov 20th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3.  
  4. using namespace std;
  5.  
  6. void do_tablicy(string **tt, int n);
  7. void zamiana(string **tt,int n);
  8. void wyswietl(string **tt,int n);
  9.  
  10. int main()
  11. {
  12. int n;
  13. cout<<"Podaj n: "; cin>>n;
  14. string **tab=new string*[n];
  15. for(int i=0;i<n;i++)
  16. tab[i]=new string[n];
  17. do_tablicy(tab, n);
  18. wyswietl(tab, n);
  19. zamiana(tab, n);
  20. cout<<endl;
  21. wyswietl(tab, n);
  22. for(int i=0;i<n;i++)
  23. delete[] tab[i];
  24. delete[] tab;
  25. return 0;
  26. }
  27.  
  28. void do_tablicy(string **tt, int n)
  29. {
  30. cout<<"Podaj elementy: "<<endl;
  31. for(int i=0;i<n;i++)
  32. {
  33. for(int j=0;j<n;j++)
  34. {
  35. cin.sync();
  36. getline(cin,tt[i][j]);
  37. }
  38. }
  39. }
  40.  
  41. void zamiana(string **tt,int n)
  42. {
  43. for(int i=0;i<n;i++)
  44. {
  45. for(int j=0;j<n;j++)
  46. {
  47. for(int k=0;k<((tt[i][j]).size()-1);k++)
  48. {
  49. if((tt[i][j]).at(k)<90 && (tt[i][j]).at(k)>65);
  50. else{
  51. (tt[i][j]).at(k)+=64;
  52. }
  53. }
  54. }
  55. }
  56. }
  57.  
  58. void wyswietl(string **tt,int n)
  59. {
  60. for(int i=0;i<n;i++)
  61. {
  62. for(int j=0;j<n;j++)
  63. {
  64. cout<<tt[i][j]<<" ||| ";
  65. }
  66. cout<<endl;
  67. }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement