fork download
  1. #include <iostream>
  2. #include <fstream>
  3. #include <cstring>
  4. using namespace std;
  5.  
  6. bool isVocal(char c) {
  7. char vocals[12] = {'a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U', '\0'};
  8. for (int i = 0; vocals[i] != '\0'; ++i) {
  9. if (c == vocals[i]) {
  10. return true;
  11. }
  12. }
  13. return false;
  14. }
  15.  
  16. int noVocals(const char* cuv) {
  17. int howManyVocals = 0;
  18. for (int i = 0; cuv[i] != '\0'; ++i) {
  19. if (isVocal(cuv[i])) {
  20. ++howManyVocals;
  21. }
  22. }
  23. return howManyVocals;
  24. }
  25.  
  26. int main() {
  27. int k;
  28. cin >> k;
  29. cin.ignore();
  30. char text[300];
  31. char correctCuv[100];
  32. int indx = 0, i = 0;
  33. while (cin >> text) {
  34. if (isalpha(text[i])) {
  35. correctCuv[indx++] = text[i];
  36. } else {
  37. if (indx > 0) {
  38. correctCuv[indx] = '\0';
  39. if (noVocals(correctCuv) >= k) {
  40. cout << correctCuv << "\n";
  41. }
  42. indx = 0;
  43. }
  44. }
  45. }
  46. if (indx > 0) {
  47. correctCuv[indx] = '\0';
  48. if (noVocals(correctCuv) >= k) {
  49. cout << correctCuv << "\n";
  50. }
  51. }
  52. return 0;
  53. }
  54.  
Success #stdin #stdout 0s 5276KB
stdin
3
Anamaria
ia nota buna la bacalaureat
stdout
Standard output is empty