Untitled
unknown
c_cpp
a year ago
839 B
3
Indexable
#include<iostream> #include<fstream> #include<vector> #include<string> void print_file(int metro, std::vector<string>& names_file) { std::string dog; std::ifstream file(names_file[metro - 1]); if(file.is_open()) { while(std::getline(file, dog)) { std::cout<<dog<<std::endl; } } file.close(); } int main() { setlocale(0, "Russian"); std::vector<std::string> names_file {"Teromo.txt", "Atom.txt", "Kinematika.txt", "STO.txt"}; while(TRUE) { int metro; cin >> metro; while (metro > 4 or metro < 1) { std::cout<<"Введено неверное значение. Введите адекватное"<<std::endl; cin >> metro; } print_file(metro); } }
Editor is loading...
Leave a Comment