Can someone help me start this program? Create a utility that transfers words th
ID: 3619079 • Letter: C
Question
Can someone help me start this program?Create a utility that transfers words that are palindromes in theinput file into the output file. Place a space between eachpalindrome written to the output file.
The input path and file name and the output path and file name mustbe gathered at runtime from the user. This can be accomplished viacommand line inputs (see argv and argc parameters in the main()function).
The program must use memory-mapped file input/output.
The contents of the input file must not be changed by your program(read only).
The definition of a palindrome, for purposes of this programmingassignment, is a word which reads the same backward or forward.Examples of palindromes are mom, pop, kayak, noon, radar, andracecar.
While there are a number of methods available to test to see if aword is a palindrome, the most common method is to use a stack.Character[0] of the original string can be compared withcharacter[n-1]. The next comparison would address character[1] withcharacter[n-2]. Comparison continues until all characters arecompared (the stack is empty) or there is an inequality (the wordis not a palindrome).
The output file should contain only those words that arepalindromes from the input file. Each word in the output fileshould be separated by a space.
Since the length of the output file is determined at runtime, andthere is no way to predict how many palindromes will be present inthe input file (without actually performing the test), there is nomeans to accurately predict the output file size required. Set theoutput file size to the input file size.
Explanation / Answer
please rate - thanks same comment as before #include #include #include using namespace std; bool isPalindrome(string ); int main(int argc, char * argv[]) {ifstream in; ofstream out; bool palin; string data; in.open(argv[1]); if(in.fail()) { coutdata; while(in) {palin=isPalindrome(data); if(palin) outRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.