Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <vector>
- #include <string>
- struct Sorter {
- private:
- std::vector<std::string> block; //a blocks
- std::size_t number; //N
- std::size_t counter; //K
- public:
- Sorter();
- Sorter(std::string path);
- ~Sorter();
- std::string setBlock (std::string node);
- std::size_t setNumber (std::size_t number );
- std::size_t setCounter(std::size_t counter);
- void setAllBlocks(std::fstream file, std::size_t start = 2);
- std::string getBlock();
- std::size_t getNumber();
- std::size_t getCounter();
- bool init(std::string path);
- Sorter& sort();
- };
- int main()
- {
- Sorter sorter;
- std::string path_to_file = "C:\Users\Administrator\Desktop
- \test.txt";
- std::size_t N, K;
- std::vector<std::string> vec;
- std::fstream file;
- file.open(path_to_file);
- file >> N;
- file >> K;
- std::cout << N << " " << K << "\n";
- file.close();
- return 0;
- }
- Sorter::Sorter() : number{0},
- counter{0}
- {}
- Sorter::Sorter(std::string path)
- {
- init(path);
- }
- Sorter::~Sorter()
- {}
- std::string Sorter::setBlock(std::string node)
- {
- block.push_back(node);
- return node;
- }
- std::size_t Sorter::setNumber(std::size_t number)
- {
- return this->number = number;
- }
- std::size_t Sorter::setCounter(std::size_t counter)
- {
- return this->counter = counter;
- }
- void setAllBlocks(std::fstream file, std::size_t start)
- {
- while ( !file.eof() ) {
- //write strings to blocks
- //////////////////////////////////////////////////////
- }
- }
- bool Sorter::init(std::string path)
- {
- // like in main()
- std::fstream file;
- file.open(path);
- if (!file.is_open()) {
- return 1;
- }
- //////////////////////////////////////////////////////////////
- return 0;
- }
- Sorter& Sorter::sort()
- {
- //////////////////////////////////////////////
- return *this;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement