ПШ
Павел Шерстнёв
#include
#include
#include
using namespace std;
void place_alpha(ostream& _o, const char* s){
int n;
while(*s) {
if(isalpha(*s)){
n = (tolower(*s) - 'a') + 1;
if(n < 10)
_o << (char)(n + '0');
else {
_o << (char)((n / 10) + '0')
<< (char)((n % 10) + '0');
}
} else
_o << *s;
++s;
}
_o.flush();
}
int main(void){
char s[] = "abc bc xyz";
cout << s << endl;
place_alpha(cout, s);
cout << endl << endl;
//...
char s1[] = "!!!";
cout << s1 << endl;
ostringstream ss;
place_alpha(ss, s1);
cout << ss.str() << endl;
return 0;
}