Untitled
unknown
c_cpp
8 months ago
1.0 kB
1
Indexable
Never
#include <iostream> #include <string> using namespace std; void caps(string& otchestvo) { if (otchestvo.size()) { if ((otchestvo[0] >= 97 && otchestvo[0] <= 122)) { otchestvo[0] -= 32; } } } void foo(string& name, string& surname, string& otchestvo, string& answer) { caps(name); caps(surname); caps(otchestvo); for (int i = 0; i < surname.length(); i++) { answer.push_back(surname[i]); } answer.push_back(' '); answer.push_back(name[0]); answer.push_back('.'); answer.push_back(otchestvo[0]); answer.push_back('.'); } int main() { setlocale(LC_ALL, "russian"); string surname; string name; string otchestvo; string answer; cin >> surname >> name >> otchestvo; cout << int(otchestvo[0]) << " \n"; /*string& n_ame = name; string& sur_name = surname;к string& paxan = otchestvo;*/ foo(surname, name, otchestvo, answer); cout << answer; }
Leave a Comment