Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello, I am working on a project for a C++ class and I have managed to complete up to the third function checkpoint, all I'm

Hello, I am working on a project for a C++ class and I have managed to complete up to the third function checkpoint, all I'm struggling with is to allow two command parameters (e.g. -v -a) to be used at once, and I need help with the 5th part. The code I have done so far has been uploaded here: https://ufile.io/7vcsz And the assignment specification is below, I hope it helps:

image text in transcribed

image text in transcribed

Assignment 2: Word Matching What's a six-letter word that has an e as its first, third, and fifth letter? Can you find an anagram of pine grave. Or how about a word that starts and ends with ant (other than ant itself, of course)? And what was the name of the place where the dinosaur killing asteroid is thought to have landed 65 million years ago? I think it was "cat something" or at least it had "cat" in it. One way to find answers to problems such as these is to search a list of words (such as the one available on most Unix systems in the file/usr/dict/words or /usr/share/dict/words) for words matchinga given pattern. Then you can easily find answers like as eleven, eyelet,grapevine, antiperspirant and Yucatan. Task Your task is to write a program, named match, that can find such matches. The program is run from the command line, using this syntax: match -OPTION].. . PATTERN [FILENAME]. The program reads words from standard input (or from each of the named files in turn) and compares them with the pattern specified on the command line. A pattern is composed of letters and underscores (_). A letter matches itself, an underscore matches any character. The input consists of words separated by whitespace. If an input word matches the specified pattern, the word is written to standard output; otherwise, nothing is written for that word. The program stops when all of the input words have been read and processed. The process of matching is controlled by command-line options With no options (or with the option -w), a word is matched if it matches the pattern in its entirety. Thus match c t(or match -wc t) would match cat or cut but not cater or scotch. .The options -p and -s specify that a word is matched if the pattern occurs as either a prefix (at the beginning) or a suffix (at the end). Thus match -p cat would match catfish or cataclysmic, and match -s cat would match scat or bobcat. The option -a allows the match to occur anywhere within a word. Thus match -a cat would match vacate and amplification. The option -e specifies that a word is matched if it is embedded within the pattern. Thus match -e vacate would match cat and ate Normally the letters in a word match only if they agree in case with the pattern. The option -i makes the match ignore the case of the word. Thus match Cat would not match cat, whereas match-i cat or match- CAT would match cat or CAT or even cAt. Assignment 2: Word Matching What's a six-letter word that has an e as its first, third, and fifth letter? Can you find an anagram of pine grave. Or how about a word that starts and ends with ant (other than ant itself, of course)? And what was the name of the place where the dinosaur killing asteroid is thought to have landed 65 million years ago? I think it was "cat something" or at least it had "cat" in it. One way to find answers to problems such as these is to search a list of words (such as the one available on most Unix systems in the file/usr/dict/words or /usr/share/dict/words) for words matchinga given pattern. Then you can easily find answers like as eleven, eyelet,grapevine, antiperspirant and Yucatan. Task Your task is to write a program, named match, that can find such matches. The program is run from the command line, using this syntax: match -OPTION].. . PATTERN [FILENAME]. The program reads words from standard input (or from each of the named files in turn) and compares them with the pattern specified on the command line. A pattern is composed of letters and underscores (_). A letter matches itself, an underscore matches any character. The input consists of words separated by whitespace. If an input word matches the specified pattern, the word is written to standard output; otherwise, nothing is written for that word. The program stops when all of the input words have been read and processed. The process of matching is controlled by command-line options With no options (or with the option -w), a word is matched if it matches the pattern in its entirety. Thus match c t(or match -wc t) would match cat or cut but not cater or scotch. .The options -p and -s specify that a word is matched if the pattern occurs as either a prefix (at the beginning) or a suffix (at the end). Thus match -p cat would match catfish or cataclysmic, and match -s cat would match scat or bobcat. The option -a allows the match to occur anywhere within a word. Thus match -a cat would match vacate and amplification. The option -e specifies that a word is matched if it is embedded within the pattern. Thus match -e vacate would match cat and ate Normally the letters in a word match only if they agree in case with the pattern. The option -i makes the match ignore the case of the word. Thus match Cat would not match cat, whereas match-i cat or match- CAT would match cat or CAT or even cAt

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Antipatterns Avoiding The Pitfalls Of Database Programming

Authors: Bill Karwin

1st Edition

1680508989, 978-1680508987

More Books

Students also viewed these Databases questions

Question

Define SQL data services and list their advantages.

Answered: 1 week ago

Question

What are Decision Trees?

Answered: 1 week ago

Question

What is meant by the Term Glass Ceiling?

Answered: 1 week ago