Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string>
- #include <iostream>
- #include <fstream>
- using namespace std;
- int main()
- {
- int a;
- string line;
- setlocale(LC_ALL, "rus");
- ifstream fout("C:\\testing\\test.txt");
- do
- {
- if (fout >> a)
- cout << a << " ";
- else
- {
- fout.clear(); // сборс режима отказа
- fout.ignore(1, ' '); //инорирование символа
- }
- } while (!fout.eof()); // возращает true, если файл закончился
- if (a == 0)
- cout << "В файле нет чисел";
- fout.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement