Pages

Wednesday, April 23, 2025

Check how many lowercase vowels occured in C++

 #include <iostream>

#include <cstring>





int main()

{


#include <iostream>

using namespace std;


bool isVowel(char ch) {

    return ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u';

}


void countLowercaseVowels(string word) {

    int vowelCount = 0;


    for (char ch : word) {

        if (isVowel(ch)) {

            vowelCount++;

        }

    }


    cout << "Number of lowercase vowels in \"" << word << "\": " << vowelCount << endl;

}


int main() {

    string input;

    cout << "Enter a word: ";

    cin >> input;


    countLowercaseVowels(input);


    return 0;

}


return 0;

}

No comments:

Post a Comment

3Sum - Leetcode solution - How i turned into two-pointer approach?

  class Solution {     public List < List < Integer >> threeSum ( int [] nums ) {         Arrays . sort (nums); // first sort...