Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //найти количество слов, начинающихся на букву w
- #include <iostream>
- #include <string.h>
- using namespace std;
- int main()
- {
- int c=0;
- char str[100] = {0};
- cout << "Vvedite stroku: ";
- cin.getline(str,100);
- if (str[0] == 'w') {
- c++;
- }
- for (int i = 1; i < strlen(str); i++)
- {
- if ((str[i - 1] == ' ') && (str[i] == 'w'))
- {
- c++;
- }
- }
- cout << c << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement