Question
Write a program that is composed of the following functions: 1. void clean(string& s); // This function keeps alphabets, digits, white spaces and any of
Write a program that is composed of the following functions:
1.
void clean(string& s);
// This function keeps alphabets, digits, white spaces and any of the characters in ".,;!?-/()", and removes all other characters. It also removes any extra spaces; allows at most one space between words.
2.
void capitalize(string& s);
It capitalizes the first letter of every word. A word is recognized if it starts at index 0 of the line, or preceded by a non-alphabet character.
3.
string split(string& s);
It splits the string into two strings if the size of the original string is greater than 80. The returned string should start at index 0 of s with a size that is less than 81 such that the split does not occur in the middle of a word.
The rest of the original string s overwrites the string s.
If the size of the original string is less than 81, the function returns a copy of s and sets s to empty string.
4.
int main();
Opens the file Text.txt for reading.
For each line in the file, it does the following:
Calls the function clean
Calls the function capitalize
Calls the function split as many times as needed (as long as s is not empty) and saves the returned strings sequentially in the file output.txt.
-----------------Test Input File---------------------
In addition, we are proud to be a reflection of the progressive spirit of the Emirates, admitting bright young men and women as students solely on the basis of their academic qualifications regardless of race, color, gender, religion, disability, age or national origin. Strategically placed between the Far East and the West, between Africa and Asia, our location is one of our greatest assets.
From ancient times to the &&& modern day, Sharjah boasts a well-deserved reputation throughout the region as an important center of commerce and trade as well as art and culture!
So invest your time, your $$$ mind and your spirit in AUS and ~ reap the benefits of your hard work and dedication in years to come. We are there for you every step of the way!
------------------------- Expected Output
In Addition, We Are Proud To Be A Reflection Of The Progressive Spirit Of The
Emirates, Admitting Bright Young Men And Women As Students Solely On The Basis
Of Their Academic Qualifications Regardless Of Race, Color, Gender, Religion,
Disability, Age Or National Origin. Strategically Placed Between The Far East
And The West, Between Africa And Asia, Our Location Is One Of Our Greatest
Assets.
From Ancient Times To The Modern Day, Sharjah Boasts A Well-Deserved Reputation
Throughout The Region As An Important Center Of Commerce And Trade As Well As
Art And Culture!
So Invest Your Time, Your Mind And Your Spirit In AUS And Reap The Benefits Of
Your Hard Work And Dedication In Years To Come. We Are There For You Every Step
Of The Way!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started