Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <windows.h>
- using namespace std;
- int main()
- {
- SetConsoleOutputCP(1251);
- const int MAX = 100;
- int count{}, i{}, length{};
- char sentence[MAX]{};
- cout << "Введіть будь-яке речення: ";
- cin.getline(sentence, MAX, '\n');
- length = strlen(sentence);
- for (i = length - 1; i >= 0; i--) {
- if (sentence[i] == ' ') {
- break;
- }
- if (sentence[i] == 'k') {
- count++;
- }
- }
- cout << "Кількість букв k в останньому слові масиву - " << count;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement