C++ C++;带结构的数组字符 struct-prof { 字符串fn; 字符串ln; 串度; 字符串dep; 字符串位置; }; int main() { ins教授[50]; int i=0; int h=0; int d=0; 智力选择; a: 根据我的理解,您希望对某种结构类型的数组进行排序
我会使用C++ C++;带结构的数组字符 struct-prof { 字符串fn; 字符串ln; 串度; 字符串dep; 字符串位置; }; int main() { ins教授[50]; int i=0; int h=0; int d=0; 智力选择; a: 根据我的理解,您希望对某种结构类型的数组进行排序,c++,C++,我会使用中的stable\u sort传递lambda对部门进行排序。首先,让我问一下“数组字符”是什么:我是新来的,抱歉我的错误,我猜我想说的是数组元素 struct prof { string fn; string ln; string deg; string dep; string pos; }; int main () { prof ins[50]; int i=0; int h=0; int d=0; int choice;
中的stable\u sort
传递lambda
对部门进行排序。首先,让我问一下“数组字符”是什么:我是新来的,抱歉我的错误,我猜我想说的是数组元素
struct prof
{
string fn;
string ln;
string deg;
string dep;
string pos;
};
int main ()
{
prof ins[50];
int i=0;
int h=0;
int d=0;
int choice;
a:
cout<<"Good Day!!"<<endl;
cout<<"How many college instructor you want to input?";
cin>>h;
for(i=0;i<h;i++)
{
cout<<"First name:";
cin>>ins[i].fn;
cout<<"Last name:";
cin>>ins[i].ln;
cout<<"Department:";
cin>>ins[i].dep;
cout<<"Position:";
cin>>ins[i].pos;
cout<<"Degree:";
cin>>ins[i].deg;
}
cout << " "<<endl;
cout << "Here are the "<<h<<" college instructor that you encode:"<<endl;
cout << " "<<endl;
for(i=0;i<h;i++)
{
cout<<"# "<<i<<" Name: "<<ins[i].fn<<" "<<ins[i].ln<<endl;
cout<<"# "<<i<<" Department: "<<ins[i].dep<<endl;
cout<<"# "<<i<<" Position: "<<ins[i].pos<<endl;
cout<<"# "<<i<<" Degree: "<<ins[i].deg<<endl;
cout<<" "<<endl;
getch ();
}
cout << " Thank you for using this program, do you want to encode again? Yes(1) No(2) "<<endl;
cin >> choice;
if (choice==1) {goto a;}
if (choice==2) {return 0;}
}