Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <set>
- using namespace std;
- set<string> getPossibleVocabulary() {
- set<string> vocabulary = {};
- string path = "C:\\Users\\Рустамчик\\Desktop\\опишка\\input.txt";
- string word = "";
- ifstream fin(path);
- if (!fin.is_open()) {
- printf("Какая-то ошибка с файлом.");
- }
- else {
- while (fin >> word) {
- vocabulary.insert({ word });
- }
- }
- fin.close();
- return vocabulary;
- }
- set<string> addNewWord(string line) {
- set<string> vocabulary = {};
- string path = "C:\\Users\\Рустамчик\\Desktop\\опишка\\input.txt";
- string word = "";
- ofstream fout(path, fstream::app);
- fout << "\n" << line;
- fout.close();
- ifstream fin(path);
- if (!fin.is_open()) {
- printf("Какая-то ошибка с файлом.");
- }
- else {
- while (fin >> word) {
- vocabulary.insert({ word });
- }
- }
- fin.close();
- return vocabulary;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement