Home > Back-end >  C language problems to solve
C language problems to solve

Time:09-23

The problem is this error the scanf input ah, I don't know what is wrong, ask the great spirit show
 # include 
# include
Struct web
{
Char abbr [8].
Char name [12].
Char URL [40];
};
Void sort (struct web webs [], int n);
# define N 4
Int main (void) {
Struct web webs [N].
int i;
Char abbr [8].
for(i=0; IThe scanf (" % s % s % s ", webs [I] abbr, webs [I]. Name, webs [I] URL);
The scanf (" % s ", abbr);

Sort (webs, N);

for(i=0; IPrintf (" % s % s % s \ n ", webs [I] abbr, webs [I]. Name, webs [I] URL);

for(i=0; IIf (STRCMP (abbr, webs [I] abbr)==0) {
Printf (" % s ", webs [I] URL);
break;
} else if (I==N - 1) {
Printf (" search url was not found ");
}
}
}

Void sort (struct web webs [], int n) {
Struct web temp;
int i,j;
for(i=0; IFor (j=0; JIf (STRCMP (webs [j]. Journal of abbr, webs [j + 1] abbr) & gt; 0 {
Temp=webs [j];
Webs [j]=webs [j + 1);
Webs [j + 1)=temp;
}
}

CodePudding user response:

I also don't know where you are wrong you what is the error of the code you want to do good difficult to let me guess

CodePudding user response:

reference 1/f, 5250 response:
I don't know where you are wrong you what is the error of the code you want to do good difficult let me guess


What are you looking forward to output the actual output? When you ask questions somehow say ah

CodePudding user response:

Oh oh, forgot to say, but I have found the mistake just now, thank you!

CodePudding user response:

The scanf (" % s % s % s ", webs [I] abbr, webs [I]. Name, webs [I] URL);
getchar();//here add empty input buffer carriage return line breaks
The scanf (" % s ", abbr);
  • Related