how to fix this bug: error code = 0x80070002? an error is caused by this line: word =listW[i]->feelWord(); and function feelWords(Word **list) work without problem, also getWord(listW, 1, needToLearn). "C++ (/ˌsiːˌplʌsˈplʌs/) is a general-purpose programming language created by Bjarne Stroustrup as an extension of the C programming language, or "C with Classes"."
#include <iostream>
#include <Windows.h>
#include <fstream>
#include <string>
#include <ctime>
class Word {
private:
string englishWord;
string translate;
public:
Word(string englishWord, string translate) {
this->englishWord = englishWord;
this->translate = translate;
}
string feelEnglishWord() {
return englishWord;
}`
string feelTranslate() {
return translate;
}
string feelWord() {
return englishWord + " - " + translate;
}
};
void feelWords(Word **list) {
string word;
for (int i = 0; i < N; i++) {
word = list[i]->feelWord();
if (word == "N - N")
return;
cout << i + 1 << '\t' << word << endl;
}
}
int N = 10;
int main() {
setlocale(LC_ALL, "ukr");
SetConsoleOutputCP(1251);
SetConsoleCP(1251);
srand(time(NULL));
int unsigned menuItem;
Word** listW = new Word* [N];
getWord(listW, 1, needToLearn);
string word;`enter code here`
for (int i = 0; i < N; i++) {
word =listW[i]->feelWord();
cout << i + 1 << '\t' << word << endl;
}
}
User contributions licensed under CC BY-SA 3.0