Advertisement
Guest User

Untitled

a guest
May 20th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <string.h>
  4.  
  5. using namespace std;
  6.  
  7. ifstream f("nr5.txt");
  8.  
  9. int vocale(char x[])
  10. {
  11. int ct = 0;
  12.  
  13. for(int i = 0; i < strlen(x); i++)
  14. {
  15. if(strchr("aeiouAEIOU", x[i]))
  16. {
  17. ct ++;
  18. }
  19. }
  20.  
  21. return ct;
  22. }
  23.  
  24. int main()
  25. {
  26. int ct = 0;
  27. char s[51];
  28.  
  29. cin.getline(s, 50);
  30.  
  31. cout << "Vocale: " << vocale(s);
  32.  
  33. int n, pos = 0, ok;
  34.  
  35. char cuv[30], aux[30];
  36.  
  37. for(int i = 0; i < n; i++)
  38. {
  39. ok = 0;
  40. f >> cuv;
  41.  
  42. if(vocale(cuv) >= 2)
  43. {
  44. for(int j = 0; j < strlen(cuv); j++)
  45. {
  46. if(strchr("aeiouAEIOU", cuv[j]))
  47. {
  48. ok = 1;
  49.  
  50. for(int y = j; y < strlen(cuv); y++)
  51. {
  52. cuv[y] = cuv[y + 1];
  53. }
  54.  
  55. cuv[strlen(cuv)] = NULL;
  56.  
  57. break;
  58. }
  59. }
  60.  
  61. if(ok == 1)
  62. {
  63. strrev(cuv);
  64. for(int j = 0; j < strlen(cuv); j++)
  65. {
  66. if(strchr("aeiouAEIOU", cuv[j]))
  67. {
  68. ok = 1;
  69.  
  70. for(int y = j; y < strlen(cuv); y++)
  71. {
  72. cuv[y] = cuv[y + 1];
  73. }
  74.  
  75. cuv[strlen(cuv)] = NULL;
  76.  
  77. break;
  78. }
  79. }
  80. }
  81.  
  82. cout << strrev(cuv) << " ";
  83. }
  84. else
  85. {
  86. cout << cuv << " ";
  87. }
  88. }
  89. return 0;
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement