ITPub博客

首页 > > > 文本的里边有换行,大写变小写的时候换行就一起给变了(0-0)!

文本的里边有换行,大写变小写的时候换行就一起给变了(0-0)!

作者:karspb 时间:2019-09-03 11:40:06 0 删除 编辑
#include<iostream>
#include<fstream>
#include<string>
using namespace std;
class chih
{

};
int main()
{
    fstream in("chih.txt", ios::in);
    if (!in)
    {
        cout << "fail to open." << endl;
        exit(1);
    }
    fstream out("chih2.txt", ios::out|ios::app);
    if (!out)
    {
        cout << "fail to open." << endl;
        exit(1);
    }
    char ah;
    while (!in.eof())
    {
        if (!'\r\n')//我想遇到个换行符就跳过去,这样貌似不行-0-??
        {

            in.get(ah);
            out.put(ah - 32);
        }
        else
        {
            in.get(ah);
            out.put(ah);
        }
    }
    in.close();
    out.close();
    return 0;


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/2001/viewspace-3134513/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2019-07-31

  • 博文量
    222
  • 访问量
    16858