Write a C++ program that reads data from an inputfile called “Input.txt” and cou
ID: 3613092 • Letter: W
Question
Write a C++ program that reads data from an inputfile called “Input.txt” and counts how many times thefile contained words that are the same as their inverse. Such wordsare called Palindromes. The input file can be downloaded from theBB. The program should print the number of palindromes found in thetext on the screen, and also saves a copy of each palindrome foundin the input file in another file (output file) called“palindromes.txt”.Write a C++ program that reads data from an inputfile called “Input.txt” and counts how many times thefile contained words that are the same as their inverse. Such wordsare called Palindromes. The input file can be downloaded from theBB. The program should print the number of palindromes found in thetext on the screen, and also saves a copy of each palindrome foundin the input file in another file (output file) called“palindromes.txt”.
Explanation / Answer
please rate - thanks #include #include #include using namespace std; bool isPalindrome( const string& ); int main() {string input; bool palin; int count=0; ifstream inFile; inFile.open("input.txt"); //open file ofstream outFile; outFile.open("palindromes.txt"); getline(inFile,input); while(inFile) {palin=isPalindrome(input); if(palin) {outFileRelated 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.