Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- #include <locale>
- using namespace std;
- void main()
- {
- setlocale(LC_ALL, "Russian");
- string surnames = "Коновалова Стрельцов Герасимова Горячева Ковалевская Фролов ";
- char s1[2];
- int count(0);
- cout << "Список женских фамилий: " << endl;
- while (surnames.length() > 0) {
- surnames.copy(s1, 2, surnames.find(' ') - 2);
- if (s1[1] == 'а') {
- count++;
- cout << surnames.substr(0, surnames.find(' ')) << endl;
- }
- if (s1[0] == 'а' && s1[1] == 'я') {
- count++;
- cout << surnames.substr(0, surnames.find(' ')) << endl;
- }
- surnames.erase(0, surnames.find(' ') + 1);
- }
- if (count == 0)
- cout << "Не найдено женских фамилий" << endl;
- system("pause");
- }
Add Comment
Please, Sign In to add comment