Advertisement
NickAndNick

Удаление гласных букв из строки

Dec 15th, 2014
802
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4. void erase_vowels(wstring&);
  5. int main() {
  6.     wcin.imbue(locale(".866"));
  7.     wcout.imbue(locale(".866"));
  8.     wcout << L"Введите текст на русском языке: ";
  9.     wstring text;
  10.     getline(wcin, text);
  11.     erase_vowels(text);
  12.     wcout << text << endl;
  13.     wcin.sync();
  14.     wcin.get();
  15.     return 0;
  16. }
  17. void erase_vowels(wstring& line) {
  18.     const wchar_t *vowels = L"АаЕеЁёИиОоУуЫыЭэЮюЯя";
  19.     wstring::size_type pos = 0;
  20.     while ((pos = line.find_first_of(vowels)) != wstring::npos) line.erase(pos, 1);
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement