The program prompts the user to enter a string, reverses it, and checks if it is a palindrome. It then swaps the case of each character in the string and displays both the original and modified strings. The program utilizes standard input/output and string manipulation functions from the C++ standard library.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
10 views
tayyab cs1
The program prompts the user to enter a string, reverses it, and checks if it is a palindrome. It then swaps the case of each character in the string and displays both the original and modified strings. The program utilizes standard input/output and string manipulation functions from the C++ standard library.
if (isPalindrome == 1) { std::cout << "The string is a palindrome." << std::endl; } else { std::cout << "The string is not a palindrome." << std::endl; }
for (int i = 0; i < length; i++) {
if (isupper(str[i])) { str[i] = tolower(str[i]); } else if (islower(str[i])) { str[i] = toupper(str[i]); } }