请问我该怎样换字符串 例:
#include<iostream>
using namespace std;
void main()
{
cout<<"how do you do";
}
我想将how 换成what 我用了底下的,可是编译时没有任何显示,郁闷啊!!
#include<iostream>
#include<fstream>
#include<string>
using namespace std;
void main()
{
ifstream fs("D:\\01.cpp");
if(!fs)
cout<<"what a pity!";
else
{
string word;
int a=0;
while(fs>>word)
{
if(word.compare("zhou")==0)
cout<<"suai";
}
cout<<word;
fstream io("D:\\01.cpp",ios_base::in|ios_base::out);
io.seekg(a);
io<<word;
a++;
}
}
我看不懂,但你既然说了我就跟吧,真不了意思,我是第一个跟的,你给不给我分??
我想帮啊,可惜只懂了一点点C
真的很抱歉