Advertisement
Guest User

szovegmanipulacio

a guest
Nov 14th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. #include <iostream>
  2. #include <cwchar>
  3. #include <windows.h>
  4.  
  5. using namespace std;
  6. using std::cout;
  7. using std::endl;
  8.  
  9. bool maganhangzoe(char a)
  10. {
  11. return a=='á' || a=='a' || a == 'e' || a=='é' || a=='o' || a=='ó' || a=='ö' || a=='ő' || a=='u' || a=='ú' || a=='ü' || a=='ű' || a=='i' || a=='í';
  12. }
  13. int main()
  14. {
  15. system("chcp 1250 > nul");
  16. cout << "Szoveg:";
  17. char szo[40];
  18. int vege = 0;
  19. char tomb[200];
  20. int holvagyunk = 0;
  21. for(int k = 0;;k++)
  22. {
  23. cin >> szo;
  24. for(int i = 0; i < 39; i++)
  25. {
  26. if(szo[i] == '\0')
  27. {
  28. tomb[holvagyunk] = '_';
  29. holvagyunk++;
  30. break;
  31. }
  32. if(szo[i] == '?')
  33. {
  34. tomb[holvagyunk] = '?';
  35. tomb[holvagyunk+1] = '\0';
  36. vege = 1;
  37. break;
  38. }
  39. tomb[holvagyunk] = szo[i];
  40. holvagyunk++;
  41. }
  42. if(vege==1)
  43. {
  44. break;
  45. }
  46. }
  47. cout << tomb << endl;
  48. for(int k = 0; k < 198; k++)
  49. {
  50. if(tomb[k]=='\0')
  51. {
  52. break;
  53. }
  54. if(tomb[k] == 'b' && tomb[k+1] == 'e' && tomb[k+2] == ',')
  55. {
  56. for(int i = 199; i >= k+3; i--)
  57. {
  58. tomb[i] = tomb[i-1];
  59. }
  60. tomb[k+2] = 'n';
  61. tomb[k+3] = ',';
  62. }
  63. }
  64. for(int k = 0; k < 200; k++)
  65. {
  66. if(tomb[k] == '\0')
  67. {
  68. break;
  69. }
  70. if(maganhangzoe(tomb[k]))
  71. {
  72. tomb[k] = 'ü';
  73. }
  74. }
  75. for(int i = 0; i < 200; i++)
  76. {
  77. if(tomb[i]=='\0')
  78. {
  79. break;
  80. }
  81. if(tomb[i]=='_')
  82. {
  83. cout << ' ';
  84. }
  85. else
  86. {
  87. cout << tomb[i];
  88. }
  89. }
  90.  
  91. return 0;
  92. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement