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

Stack using Linked List – Partial (University Exam Topic)

 #include <iostream> using namespace std; struct Node {     int data;     Node* next; }; class Stack {     Node* top; public:     Stac...