[ create a new paste ] login | about

Link: http://codepad.org/VTuepm8W    [ raw code | output | fork ]

C++, pasted on Dec 16:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <iostream>
#include <string>
using namespace std;

void strconv(string& s) {
  const char* snum[] = { 
    "нуль", "один",  "два",  "три",    "четыре", 
    "пять", "шесть", "семь", "восемь", "девять"
  };
  string::size_type p;
  for(p = 0; (p = s.find_first_of("0123456789", p)) != string::npos; p++)
     s.replace(p, 1, snum[s[p]-'0']);
}

int main(void) {
   string str = "0 the 1,2,3(5) super war craft[8][9][1]<6>";
   //cin >> str;
   strconv(str);
   cout << str << endl;
   return 0;
}


Output:
1
нуль the один,два,три(пять) super war craft[восемь][девять][один]<шесть>


Create a new paste based on this one


Comments: