Untitled

mail@pastecode.io avatar
unknown
c_cpp
2 months ago
1.1 kB
1
Indexable
Never
#include <iostream>
#include <string>
using namespace std;

void foo(string& name, string& surname, string& otchestvo, string& answer) {
    if (surname.size()) {
        if (surname[0] >= 97 and surname[0] <= 122) {
            surname[0] -= 32;
        }
    }
    if (name.size()) {
        if (name[0] >= 97 and name[0] <= 122) {
            name[0] -= 32;
        }
    }
    if (otchestvo.size()) {
        if (otchestvo[0] >= 97 and otchestvo[0] <= 122) {
            otchestvo[0] -= 32;
        }
    }
    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]);
}

int main()
{
    string name;
    string surname;
    string otchestvo;
    string answer;
    cin >> name >> surname >> otchestvo;
    /*string& n_ame = name;
    string& sur_name = surname;
    string& paxan = otchestvo;*/
    foo(name, surname, otchestvo, answer);
    cout << answer;
}
Leave a Comment