Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C PROGRAM write a function which takes a string argument and a character argument. It should return a truth value (int 0 or 1), 0

C PROGRAM

write a function which takes a string argument and a character argument. It should return a truth value (int 0 or 1), 0 if the string does not contain the character, and 1 if the string does contain the character. Do not use a built-in library for this. Again, call this function and its variables whatever you deem appropriate. The main function of the program should accept a single character followed by Enter. Then, it will read lines until the end of input (we'll call that EOF from now on). It should pass these lines to the function you wrote. If the character is in the line, it should print "FOUND: " and then the full line. If the character is not in the line, it should print "NOT FOUND: " and then the line. Assume lines of input are no longer than 1000 bytes in length. Also, make sure that your program can accept an arbitrary number of lines of input. Either 5, 10, 90, or 1000 lines of input can be given after the first character and it should still work as intended even if you gave the program more input. Again, signal the EOF with CTRL+D. You should only need one buffer

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_2

Step: 3

blur-text-image_3

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

More Books

Students also viewed these Databases questions

Question

3. Describe the communicative power of group affiliations

Answered: 1 week ago