Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <algorithm>
- using namespace std;
- int main() {
- cout << "Program oblicza ilosc samoglosek i spolglosek w zdaniu" << endl;
- cout << "Podaj zdanie: ";
- string zdanie = "";
- getline(cin, zdanie);
- transform(zdanie.begin(), zdanie.end(), zdanie.begin(), ::tolower);
- int d = zdanie.length();
- int ilosc_samoglosek = 0, ilosc_spolglosek = 0;
- for (int i=0; i<d; i++) {
- if ((zdanie[i] == 'a') ||
- (zdanie[i] == 'e') ||
- (zdanie[i] == 'y') ||
- (zdanie[i] == 'i') ||
- (zdanie[i] == 'o') ||
- (zdanie[i] == 'ฤ ') ||
- (zdanie[i] == 'ฤ') ||
- (zdanie[i] == 'u') ||
- (zdanie[i] == 'รณ'))
- ilosc_samoglosek++;
- else if (zdanie[i] != ' ') ilosc_spolglosek++;
- }
- cout << "Ilosc samoglosek w zdaniu: " << ilosc_samoglosek << endl;
- cout << "Ilosc spolglosek w zdaniu: " << ilosc_spolglosek;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement