Implement the filters: longLines, linesWith. The filters have similar structure. They accept one parameter from the command line (length limit or a string of characters) and then read, one by one, all lines from the standard input. Each line is tested. The only difference consists in different functions used to reject or accept lines. Functions strlen and strstr could simplify the implementation of the respective filters.
Use the pipeline processing to:
• Print out a sorted list of all words in the file test.txt that are longer then 10 characters.
• Print out a sorted in reverse order all words the file test.txt that are longer that contain the string xxxx.
• Count how many times the word xxx is in the file text.txt.

#include <stdio.h>
#include <ctype.h>

int main(int argc, char* argv[])
int c;
int prevC=0;
while ((c=getchar())!=EOF)
if (isalpha(c))
if (isalpha(prevC))
9 Years
Discussion Span
Last Post by WaltP

Someone forgot the CODE tags that were mentioned in the Rules you read when you registered. Not only that, you typed right over exactly how to use them when you entered your message. It helps us help you if you try harder.

You also neglected to format your code. This also helps. Aren't instructors teaching how to properly write code these days?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.