Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <conio.h>
- using namespace std;
- int main()
- {
- wcin.imbue(locale(".866"));
- wcout.imbue(locale(".866"));
- int N;
- wcout << L"Введите N="; cin >> N;
- wstring* words = new wstring[N];
- wstring** words_selected_ptrs = new wstring*[N];
- int words_selected_i = 0;
- for (int i=0; i < N; i++)
- {
- wcout << L"Слово " << (i + 1) << ": ";
- wcin >> words[i];
- int good = 1;
- for (int s = 1; s < words[i].length(); s++)
- {
- if (words[i][s] < words[i][s - 1])
- {
- good = 0;
- break;
- }
- }
- if (good)
- {
- words_selected_ptrs[words_selected_i] = &(words[i]);
- words_selected_i++;
- }
- }
- for (int i = 0; i < words_selected_i; i++)
- {
- wcout << (wstring) *(words_selected_ptrs[i]) << endl;
- }
- delete[] words;
- delete[] words_selected_ptrs;
- getchar();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement