上图输出后要怎么才能出现下图的内容?怎么添加语句?
要怎么输出以下内容?
#include<iostream>
#include<string>
#include<cctype>
using namespace std;
int main() {
string str;
cout << "输入一个字符串:";
getline(cin, str);
cout << "----------------" << endl;
cout << "原始字符串为:" << endl;
cout << str << endl;
cout << "修改后的字符串为:" << endl;
for (int i = 0; i < str.size(); i++) {
if (isalpha(str[i])) {
if (islower(str[i])) {
str[i] = toupper(str[i]);
}else{
str[i] = tolower(str[i]);
}
}
}
cout << str << endl;
return 0;
}