Deprecated: Constant E_STRICT is deprecated in /var/www/cppe.ru/www/includes/exception/MWExceptionHandler.php on line 179
Deprecated: Creation of dynamic property PPDStack::$accum is deprecated in /var/www/cppe.ru/www/includes/parser/Preprocessor_DOM.php on line 803
Deprecated: Constant E_STRICT is deprecated in /var/www/cppe.ru/www/includes/exception/MWExceptionHandler.php on line 179
Deprecated: Constant E_STRICT is deprecated in /var/www/cppe.ru/www/vendor/mediawiki/at-ease/src/Functions.php on line 48
Материал из C\C++ эксперт
Use reverse function on list
#include <iostream>
#include <cassert>
#include <list>
#include <string>
#include <algorithm> // for reverse
using namespace std;
int main()
{
string s("asdfg");
list<char> list1(s.begin(), s.end());
list<char>::iterator i;
for (i = list1.begin(); i != list1.end(); ++i)
cout << *i;
reverse(list1.begin(), list1.end());
for (i = list1.begin(); i != list1.end(); ++i)
cout << *i;
return 0;
}
/*
asdfggfdsa
*/