Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <fstream>
- #include <locale>
- #include <windows.h>
- using namespace std;
- struct
- {
- string filename;
- ifstream file;
- unsigned int struct_cnt = 0;
- COORD pos;
- }ftool;
- struct Book
- {
- string author;
- string name;
- int year;
- };
- int main()
- {
- setlocale(LC_ALL, "Russian");
- cout<<"Введите имя файла:"<<endl;
- getline(cin, ftool.filename);
- ftool.file.open(ftool.filename.c_str(), ios_base::in);
- char buff;
- do
- {
- ftool.file>>buff;
- if(buff=='~'){ftool.struct_cnt++;}
- }while(!ftool.file.eof() && ftool.struct_cnt<20);
- ftool.file.seekg(0);
- do
- {
- ftool.file>>buff;
- }while(!ftool.file.eof());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement