Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool check_str_to_int(string str) {
- for (int i = 0; i < str.length(); i++) {
- if (!isdigit(str.at(i))) return false;
- }
- return true;
- }
- void table::imprt(string note) {
- string shop, name, cost_str;
- int cost;
- ifstream in(note);
- if (in.is_open()) {
- while (!in.eof()) {
- in >> shop;
- in >> name;
- in >> cost_str;
- if (check_str_to_int(cost_str)) {
- add(shop, name, stoi(cost_str));
- } else {
- cout << "Ошибка чтения (" << cost_str << ")" << endl;
- }
- }
- del(shop, name);
- }
- else {
- cout << "File not Found: " << note << "\n";
- }
- in.close();
- }
Advertisement
Add Comment
Please, Sign In to add comment