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

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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