Re: [問題] 陣列內中英文字串的反轉(序)
#include <iostream>
#include <string>
#include <algorithm>
#include <fstream>
using namespace std;
int main()
{
ifstream Input("input.txt");
ofstream Output("output.txt");
if(!Input)
{
exit(1);
}
string temp;
while(getline(Input, temp))
{
for(string::size_type ix = 0; ix < temp.size(); ix++)
if(temp[ix] < 0)
swap(temp[ix], temp[ix++]);
reverse(temp.begin(), temp.end());
Output << temp << '\n';
temp.clear();
}
Input.close();
Output.close();
return 0;
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 59.116.165.235
※ 編輯: joefaq 來自: 59.116.165.235 (03/22 12:17)
→
03/22 12:17, , 1F
03/22 12:17, 1F
→
03/22 12:17, , 2F
03/22 12:17, 2F
※ 編輯: joefaq 來自: 59.116.165.235 (03/22 12:21)
推
03/22 12:40, , 3F
03/22 12:40, 3F
推
03/22 12:43, , 4F
03/22 12:43, 4F
推
03/22 18:58, , 5F
03/22 18:58, 5F
→
03/22 18:58, , 6F
03/22 18:58, 6F
推
03/22 20:07, , 7F
03/22 20:07, 7F
→
03/22 20:07, , 8F
03/22 20:07, 8F
→
03/22 20:08, , 9F
03/22 20:08, 9F
推
03/22 21:52, , 10F
03/22 21:52, 10F
→
03/23 18:06, , 11F
03/23 18:06, 11F
→
03/23 18:06, , 12F
03/23 18:06, 12F
討論串 (同標題文章)
完整討論串 (本文為第 4 之 4 篇):