Question: 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

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!