##include<iostream>
using namespace std;
const int strsize=10;
void showmenu();
struct bop
{
char fullname[strsize];
char title[strsize];
char bopname[strsize];
int preference;
};
int main()
{
showmenu();
bop num1[5]=
{
{"adj jda","dahj dad","sdssds ds",0},
{"yew", "we", "ewe",1},
{"adkj","sdk","sd",2},
{"sfk","jda","jjjf",1},
{"ash","jaj","sjda",2}
};
char choice;
cin>>choice;
while(choice!='q')
//while() 这个不行啊
{
switch(choice)
{
case 'a':
for(int i=0;i<5;i++)
cout<<num1[i].fullname<<endl;
break;
case 'b':
for(int j=0;j<5;j++)
cout<<num1[j].title<<endl;
break;
case 'c':
for(int k=0;k<5;k++)
cout<<num1[k].bopname<<endl;
break;
case 'd':
for(int l=0;l<5;l++)
{
if(num1[l].preference==0)choice='a';
else if(num1[l].preference==1)choice='b';
else if(num1[l].preference==2)choice='c';
}
};
cin>>choice;
};
cout<<"BYB!";
return 0;
}
void showmenu()
{
cout<<"please enter one of the following choices:\n"
"a)display by name b)display by title\n"
"c)display by bopname d)display by prefernce\n"
"q)quit\n";
}
/*void showelem1(bop& elem[j],)
{
for(int i=0;i<5;i++)
cout<<elem.fullname<<endl;*/
D:\新建文件夹\c64.cpp(92) : error C2360: initialization of 'i' is skipped by 'case' label
D:\新建文件夹\c64.cpp(81) : see declaration of 'i'