Код: Выделить всё
class Question {
public:
String quest_text;
String optionA;
String optionB;
String optionC;
String optionD;
int right_answer;
Question() {}
Question(String b,String c,String d,String e,String f,int g) {
quest_text = b;
optionA = c;
optionB = d;
optionC = e;
optionD = f;
right_answer = g;
}
bool test_answers() {
bool is_true = false;
if (right_answer == 2 && pressed2 == true) {
is_true = true;
} else if (right_answer == 3 && pressed3 == true) {
is_true = true;
} else if (right_answer == 4 && pressed4 == true) {
is_true = true;
} else if (right_answer == 5 && pressed5 == true) {
is_true = true;
}
return is_true;
}
};
Question* current_question;
int question_number = 0;
//EVERY QUESTION EVER WILL BE HERE
Question all_questions[5] = {
Question("soru1","ax","b","c","d",2),
Question("soru2","a","b","c","dx",5),
Question("soru3","a","b","cx","d",4),
Question("soru4","a","bx","c","d",3),
Question("soru5","a","b","cx","d",4)
};
void next_question(Question* a) {
a = &all_questions[question_number];
question_number++;
}
< /code>
Нажатые переменные - это переменные, которые я получаю от доски Arduino, они не способствуют моей проблеме < /p>
next_questionТакже вот ошибка
Код: Выделить всё
3:20: error: variable or field 'next_question' declared void
3:20: error: 'Question' was not declared in this scope
3:20: note: suggested alternative: 'union'
3:30: error: 'a' was not declared in this scope
avr[0m 1.8.6 [90m/home/tcad/.arduino15/packages/arduino/hardware/avr/1.8.6[0m
exit status 1
< /code>
Вот код, который я обрезал столько, сколько мог, это все еще дает такую же ошибку < /p>
class Question {
public:
String quest_text;
String optionA;
String optionB;
String optionC;
String optionD;
int right_answer;
Question() {}
Question(String b,String c,String d,String e,String f,int g) {
quest_text = b;
optionA = c;
optionB = d;
optionC = e;
optionD = f;
right_answer = g;
}
};
Question* current_question;
int question_number = 0;
//EVERY QUESTION EVER WILL BE HERE
Question all_questions[5] = {
Question("soru1","ax","b","c","d",2),
Question("soru2","a","b","c","dx",5)
};
void next_question(Question* a) {
a = &all_questions[question_number];
}
Подробнее здесь: https://stackoverflow.com/questions/795 ... a-function