Ответ:
#include <iostream>
#include <map>
#include <string>
using namespace std;
int main()
{
map<string, string> students;
students["Ivanov"] = "Ivan";
students["Petrov"] = "Petro";
students["Sidorov"] = "Sidor";
string surname;
cout << "Enter surname: ";
cin >> surname;
cout << "Name: " << students[surname] << endl;
return 0;
}
Объяснение:
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Ответ:
#include <iostream>
#include <map>
#include <string>
using namespace std;
int main()
{
map<string, string> students;
students["Ivanov"] = "Ivan";
students["Petrov"] = "Petro";
students["Sidorov"] = "Sidor";
string surname;
cout << "Enter surname: ";
cin >> surname;
cout << "Name: " << students[surname] << endl;
return 0;
}
Объяснение: