- #include<bits/stdc++.h>
- using namespace std;
- int main(int argc, char** argv) {
- string str;
- ifstream ifs;
- ifs.open("C:\\Users\\student\\Downloads\\read.txt");
- getline(ifs,str);
- for(int i=0;i<=str.length();i++){
- if(str[i]=='*'){
- str.erase(i,1);
- i=i-1;
- continue;
- }else{
- cout<<str[i];
- }
- }
- ofstream ofs;
- ofs.open("write.txt");
- ofs<<str;
- return 0;
- }
複製代碼 |