topic description
I hope the gods can give me the code
sources of topics and their own ideas
A lookup function that uses the strcmp function to compare
related codes
/ / Please paste the code text below (do not replace the code with pictures)
this is the defined structure
typedef struct snode
{
int No; //
char Name[20]; //
char Gender[5]; //
int Cnt; //
LNode *cj; //
char brithday[20];//
double Avg; //
char party[6]; //
char phoneNo[15];//
char addr[20]; //
}SNode;
void Search(SNode *a,int Count){
char r[20];
strcpy(r,"1");
if(Count==0)
cout<<""<<endl;
else{
int sel;
do{
system("CLS");
menu2();
cin>>sel;
system("CLS");
if(sel==1) do{
int flag=0;
cout<<",0"<<endl;
cin>>r;
for(int j=0;j<Count;jPP)
if(strcmp(a[j].No,r)==0){
cout<<a[j].No<<" "<<
a[j].name<<" "<<
a[j].gender<<" "<<
a[j].brithday<<" "<<
a[j].phoneNo<<" "<<
a[j].party<<" "<<
a[j].addr<<endl;
flag=1;}
if(!flag)
cout<<""<<endl;
}while(strcmp(r,"0")!=0);
else if(sel==2)
do{
strcpy(r,"1");
int flag=0;
cout<<"0"<<endl;
cin>>r;
for(int j=0;j<Count;jPP)
if(strcmp(a[j].name,r)==0){
cout<<a[j].No<<" "<<
a[j].name<<" "<<
a[j].gender<<" "<<
a[j].brithday<<" "<<
a[j].phoneNo<<" "<<
a[j].party<<" "<<
a[j].addr<<endl;
flag=1;}
if(!flag)
cout<<""<<endl;
}while(strcmp(r,"0")!=0);
else if(a==0)
break;
else{
cout<<""<<endl;
system("pause"); }
}while(1);}
break;
}
what result do you expect? What is the error message actually seen?
it"s mainly the error of strcmp