Question: Write a C++ Program that: Uses strings Passes strings to functions Uses file I/O. Project Requirements: 1. Write a function that, given two strings as
Write a C++ Program that:
Uses strings
Passes strings to functions
Uses file I/O.
Project Requirements:
1. Write a function that, given two strings as input, checks if one string is a substring of the other. If so, capitalize the substring and print the new capitalized string.
For example: If the input is Begin and in. Then we must check if any of these strings is a substring of the other. If yes print a statement as below.
Yes, in is substring of Begin
Now capitalize the substring and write the new capitalized string to a new file specified by the user. The new string for the above example is BegIN. You should ignore case when comparing strings; that is, given Hilly and hill as input the function should still find hill to be a substring of Hilly.
2. Read the words (strings) from a file the user chooses in main() and write the new strings to another file of the users choice.
3. You have a few choice in implementation:
Use of either old style c-strings (character arrays) or the string (#include
Use of a data structure (array or vector) to store the strings. You can store the strings in such a container, or you can just read and write them without using storage.
Sample
Please enter the input filename: input.txt
Please enter the output filename: output.txt
The original strings are:
String
Ring
Ring is a substring of String
The new string is: StRING
Content has been written to the file output.txt.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
