错误 C2361:'found'的初始化被'default'标签跳过
错误 C2361:'found'的初始化被'default'标签跳过
这个问题已经有了答案:
可能是重复:
我在下面的代码中遇到了一个奇怪的错误:
char choice=Getchar(); switch(choice) { case 's': cout<<" display tree "; thetree->displaytree(); break; case 'i': cout<<" enter value to insert "<<endl; cin>>value; thetree->insert(value); break; case 'f' : cout<< "enter value to find "; cin>>value; int found=thetree->find(value); if(found!=-1) cout<<" found = "<<value<<endl; else cout<< " not found " <
Visual Studio 2010 编译器说:
1>c:\users\daviti\documents\visual studio 2010\projects\2-3-4\2-3-4\2-3-4.cpp(317): error C2361: initialization of 'found' is skipped by 'default' label 1> c:\users\daviti\documents\visual studio 2010\projects\2-3-4\2-3-4\2-3-4.cpp(308) : see declaration of 'found'
我认为我已经正确地写了break和default语句,那么错误在哪里?
admin 更改状态以发布 2023年5月20日