<pre name= "code" class= "CPP" >/* enter multiple lines of information in the terminal, find the line containing "Ould" and print a row such as: Au,love could you and I with fate conspireto grasp thi s sorry scheme of things entire,would not we shatter it to bitd-and then. Output the above text in the terminal, output au,love could you and I with fate Conspirewould not we shatter it to Bitd-and then.*/#include <stdio.h> #define MAXLINE 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; } int Compare (char Line[],char str[]) {int i,j,k; for (i = 0;line[i]! = ' + '; i++) {for (j = i,k = 0;str[k]!= ' + ' && Str[k] = = line[j];j++,k++) {; } 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 language" in the terminal to enter multiple lines, find "Ould" line, and print.