感谢伟大的CSS!
题目描述:
创建一个内容为“I hate C++ and hate programming!"的文本文件。编写程序读取该文件的内容,并将其中出现的”hate“全部替换成”love“后,输出到控制台。编写的程序应具有通用性,可以正确处理其他的文本文件。
代码如下:
/*
Create "playing.txt" in the present directory,
which contains "I hate C++ and hate Programming",
Your task is to exchange all the "hate" in the text with "like",
and after that you'll get "I like C++ and like Programming."
*/
#include <iostream>
#include<string.h>
#include<fstream>
#include<stdio.h>
#include<stdlib.h>
using namespace std;
int main()
{
//string verb;
char verb;
fstream change;