将字符串翻转输出
Code
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
ifstream fs("d:\\rainbow\\Yazi.txt", ios::in, 0);
ofstream ofs("d:\\rainbow\\yazi-revert.txt", ios::out, 0);
string buf;
std::getline(fs, buf);
while(!fs.eof())
{
reverse(buf.begin(), buf.end());
ofs<<buf<<endl;
std::getline(fs, buf);
}
fs.close();
ofs.close();
std::cout<<"Completed."<<endl;
return 0;
}
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
ifstream fs("d:\\rainbow\\Yazi.txt", ios::in, 0);
ofstream ofs("d:\\rainbow\\yazi-revert.txt", ios::out, 0);
string buf;
std::getline(fs, buf);
while(!fs.eof())
{
reverse(buf.begin(), buf.end());
ofs<<buf<<endl;
std::getline(fs, buf);
}
fs.close();
ofs.close();
std::cout<<"Completed."<<endl;
return 0;
}