Compare a source string and a charset string

Assignment Help Computer Engineering
Reference no: EM132198093

WRITE THE ENTIRE PROGRAM IN C++ ONLY.

Pointers

Task: Use pointers to compare two sets of characters, a source string and a charSet string.

Your program will include a function called searcher that uses pointers to both the source string and the character set, and which returns a pointer to a char.

The searcher function should use exactly this prototype (do not include any other parameters, and don't take advantage of any global variables in the searcher function):

char *searcher (char *source, char *charSet);

The basic idea is to locate the first character in the source string that matches any of the characters in thecharSet string. The function then returns a pointer to the place in source where the first match was found.

If none of the characters in source match any of the chars in charSet, then a NULL pointer is returned. Note that you are searching for a single character, not a substring, although what you will print is a substring.

The calling program should use the pointer returned from searcher.

For example:

Suppose source points to: ABCBGFE

(a) If charSet points to XYZ, then NULL is returned.

(b) If charSet points to XREQCF, then the function should return a pointer to the letter C in source; the substring CBGFE will be printed.

(c) If charSet points to FFGG, then the function should return a pointer to the letter G in source; the substring GFE will be printed.

(d) If charSet points to GBF, then the function should return a pointer to the first letter B in source; the substring BCBGFE will be printed.

Constraints: This program is intended to provide practice with pointers, so these limitations will apply:

You may not use any C-string or string object commands. For example, strcpy, strcmp, strlen, etc., are all off-limits.

You may not use array subscripts (brackets) anywhere in the searcher function. Use pointer notation rather than array notation in that function. However, the input function may read strings into array variables, i.e., into C-strings.

Processing: The program should be interactive. The user will provide a source string and also a character set string. The program should continue processing strings until the user signals for completion.

Output: After each search, print the following summary:

the source string

the charSet string

the address of the source string

the substring of the source string that starts at the position found by searcher if the search was successful, or print "unsuccessful search"

Reference no: EM132198093

Questions Cloud

What is the prevalence of flu at the end of the week : Over the next week, 5 new students develop the flu. What is the prevalence of flu at the end of the week?
How the issue affects the us-world economy : You are required to find a significant current economic issue relating to healthcare. You are to write 3-5 page paper regarding this issue as described below.
What is the probability that a victim randomly selected : What is the probability that a victim randomly selected from this group was alive, given that they did not wear a seat belt?
How much would girl scouts be willing to bribe the baker for : Suppose the Omaha baker is a jerk and is threatening to publish all of the secret recipes on the Internet. Assume people only buy Girl Scout cookies.
Compare a source string and a charset string : Your program will include a function called searcher that uses pointers to both the source string and the character set, and which returns a pointer to a char.
Plot the firm instantaneous ac function : Draw two graphs, side-by-side. Plot the firm's learning curve over these three years on one graph. On the other graph, plot the firm's instantaneous.
What possible shape can the ac function take : In Industry D, she knows the shape of the AC curve and the value of the MES, which is a positive, finite number. She also knows the consumer demand function.
Provide to new internet users to help them safeguard : Write a discussion post that lists five suggestions you would provide to new internet users to help them safeguard their privacy.
Explain the reason why the trade pattern is the way it is : Draw the production possibility frontier for each country. Which country has a comparative advantage in apples, which one in bananas?

Reviews

Write a Review

Computer Engineering Questions & Answers

  Discuss what is a collision onto a mac value

What is a collision onto a MAC value. Why is it very unlikely

  Questionuse jsp to prepare an amortization table for a loan

questionuse jsp to prepare an amortization table for a loan. create a html form that uses-1. textbox to enter loan

  Determine the centroids of the quantization regions

[Determining the Centroids] Determine the centroids of the quantization regions for a zero-mean, unit-variance Gaussian distribution.

  Invite the largest set of friends possible

Your goal is to invite the largest set of friends possible such that no pair of invited friends dislike each other.

  How can you ensure that users do not notice the change

How can you ensure that users don't notice this change? Explain the significance of fast symbolic links and dangling symbolic links.

  Oe of the needs that your client has is a databaseto

one of the needs that your client has is a database.to design a database a database planner should spend a

  There are five factors to consider when assessing the

there are five factors to consider when assessing the growing impact of it in business firms both today and over the

  Create a pricing system for a company

Create a pricing system for a company that makes individualized computers, such as you might see on a Web site. There are two kinds of computers.

  Write two ways of clearing contents of an address register

The 68000 does not permit the operation CLR AO (because address register direct is not a legal addressing mode for a CLR instruction).

  How would you respond in a way that islegal or moral

You are a software engineer working at a large publicly-traded corporation, where a colleague invents a new kind of compiler.

  Design and implement an application reads in a set

Design and implement an application reads in a set of 200 grades into a two-dimensional array from a .txt file called studentanswers that represent.

  Create a network security vulnerability and threat table

Create a network security vulnerability and threat table in which you outline the security architecture of organization and cryptographic means of protecting.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd