/* Enter multiple lines of information in the terminal, locate the line containing "Ould", and print the row. such as: Au,love could you and I with fate Conspireto grasp the sorry scheme of things entire,would not we shatter it to BITD- And then. Output the above text in terminal, output au,love could you and I with fate conspirewould not we shatter it to Bitd-and then.*/#include < ;stdio.h> #define MAXLINE 1000//gets to a line of characters to determine whether to get to a row and put it into an array inside prepare to compare int getline (char ar[],int max) {int Ch int i = 0; while ((ch = getchar ())! = EOF && ch! = ' \ n ' && i < max) {ar[i] = ch; i++; } if (ch = = ' \ n ') ar[i++] = ch; Ar[i] = ' + '; return i; }//Compare to determine if there is no target string int compare (char Line[],char str[]) {int i,j,k; for (i = 0; Line[i]! = ' + '; i++) {//Where I is identified by a J and let J go backwards to compare with K for (j = i,k = 0; str[k]! = ' && ' Amp Str[k] = = Line[j]; j++,k++) {; }//If k is moved and K does not go to the last indication of successful if (k>0 && str[k] = = ' + ') return 1; } return 0; } int main () {char line[maxline]; Char str[] = "ould"; while (Getline (line,maxline)) {if (compare (LINE,STR)) printf ("---%s\n", line); } return 0; }
"C" Enter multiple lines of information in the terminal, find the line containing "Ould", and print the row