"'element'的初始化被'case'标签跳过"。
"'element'的初始化被'case'标签跳过"。
这个问题已经在这里得到了答案:
我不明白为什么出现了以下错误:
\"element\"的初始化被\"case\"标签跳过了。
请有人可以解释一下吗?
void LinkedList::process_example(int choice) { switch(choice) { case 1: cout << endl << endl << "Current S = "; this->printSet(); cout << "Enter an element :"; char* element = "lol"; //cin>>element; cin.clear(); cin.ignore(200, '\n'); this->Addelementfromback(element); //error is here cout << endl << endl << "Current S = "; this->printSet(); break; case 2: this->check_element(); break; case 3: cout << endl << endl; cout << "Current Set S = "; this->printSet(); cout << endl << "S has "; int count = this ->check_cardinality(); cout << count << " elements"; break; } }
admin 更改状态以发布 2023年5月23日