Closed harshraj8843 closed 3 months ago
std::string reverseCase(const std::string& str) { std::string result = str; for (char& c : result) { if (std::islower(c)) { c = std::toupper(c); } else if (std::isupper(c)) { c = std::tolower(c); } } return result; }
int main() { std::string inputString; std::cout << "Enter a string: "; std::getline(std::cin, inputString);
std::string reversedCaseString = reverseCase(inputString);
std::cout << "String in reverse case: " << reversedCaseString << std::endl;
return 0;
}
Description
Write a program to convert string to reversecase
Reversecase is a style of writing in which all lowercase letters are converted to uppercase and all uppercase letters are converted to lowercase.
Tracking Issues