xxxxxxxxxx
123456789101112131415161718192021
#include <iostream>using namespace std;string convertString(string& str){int length = str.length();for (int i = 0; i < length; i++){if (str[i] >= 'a' && str[i] <= 'z'){str[i] = str[i] - 32;}else if (str[i] >= 'A' && str[i] <= 'Z'){str[i] = str[i] + 32;}}return str;}int main(){string str1 = "ABraCAdaBRa"; cout << "Original String 1:" << endl; cout << str1 << endl;str1 = convertString(str1); cout << "Converted String 1:" << endl; cout << str1 << endl;return 0;}