codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
#include <iostream> #include <algorithm> #include <numeric> #include <locale> int main() { setlocale(LC_ALL, ""); char arr[] = "0123xxx##yyy#zzz"; const size_t N = strlen(arr); std::cout << "Сумма кодов: " << std::accumulate(arr, arr+N, 0) << std::endl; const size_t signs = std::count(arr, arr+N, '#'); std::replace(arr, arr+N, '#', 'A'); std::cout << "Количество #: " << signs << std::endl; std::cout << "После преобразования: " << arr << std::endl; return 0; }
Private
[
?
]
Run code
Submit