Наши проекты:
Журнал · Discuz!ML · Wiki · DRKB · Помощь проекту |
||
ПРАВИЛА | FAQ | Помощь | Поиск | Участники | Календарь | Избранное | RSS |
[54.82.44.149] |
|
Сообщ.
#1
,
|
|
|
Помогите перевести в блок схему:
#include <iostream> #include <set> #include <cassert> #include <algorithm> #include <iterator> int main(){ const int SIZE = 10; int arr[SIZE] = { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 }; std::cout << "Unsorted: "; std::copy(arr, arr + SIZE, std::ostream_iterator<int>(std::cout, " ")); std::cout << std::endl; std::multiset<int> set; std::copy(arr, arr + SIZE, std::inserter(set, set.begin())); assert(set.size() == SIZE); bool flag = true; int * pHead = arr; int * pTail = arr + SIZE - 1; for (std::multiset<int>::const_iterator i = set.begin(); i != set.end(); ++i){ if (flag) *pHead++ = *i; else *pTail-- = *i; flag = !flag; } std::cout << "Sorted: "; std::copy(arr, arr + SIZE, std::ostream_iterator<int>(std::cout, " ")); std::cout << std::endl; system("pause"); return 0; } |
Сообщ.
#2
,
|
|
|
M Используем тег [code] для добавления текста программы в пост! Устное предупреждение! Читаем правила! |