подготовьте сообщение (мини проект) на тему << Погодные аномалии на Кубани и методы борьбф с опасными природными явлениями>> КРАТКО 8 класс по кубановедине ДАЮ 100 БАЛОВ​

Ответы

Ответ дал: rebusqwq
2

Ответ:

Пожалуйста переведите код в с(си)

int main()

{

std::vector > vec;

std::ifstream fin("race.in");

int n;

fin >> n;

if (n <= 0)

exit(1);

std::string country;

std::string name;

for (int i = 0; i < n; i++) {

fin >> country >> name;

vec.push_back(std::make_pair(country, name));

}

std::stable_sort(vec.begin(), vec.end(), [](const auto& l, const auto& r) {return l.first < r.first; });

std::ofstream fout("race.out");

country = vec[0].first;

fout << "=== " << country << " ===" << std::endl;

for (const auto& it : vec) {

if (country != it.first) {

country = it.first;

fout << "=== " << country << " ===" << std::endl;

}

fout << it.second << std::endl;

}

}

Похожие вопросы