Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <set>
- #include <cctype>
- using namespace std;
- set<string> createPossibleVocabulary(bool& englishLanguage) {
- string path;
- set<string> vocabulary = {};
- if (englishLanguage) {
- path = "..\\..\\englishvocabulary.txt";
- }
- else {
- path = "..\\..\\russianvocabulary.txt";
- }
- string word = "";
- ifstream fin(path);
- if (!fin.is_open()) {
- printf("Какая-то ошибка с файлом.");
- }
- else {
- while (fin >> word) {
- vocabulary.insert({ word });
- }
- }
- fin.close();
- return vocabulary;
- }
- void addNewWord(string line, set<string>& vocabulary, bool& englishLanguage) {
- string path;
- string word = "";
- if (englishLanguage) {
- path = "..\\..\\englishvocabulary.txt";
- }
- else {
- path = "..\\..\\russianvocabulary.txt";
- }
- ofstream fout(path, fstream::app);
- fout << "\n" << line;
- fout.close();
- vocabulary.insert({ line });
- }
- void lowcase(string& word) {
- for (char& c : word) {
- c = tolower(c);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement