Created
September 30, 2013 17:16
-
-
Save SeqviriouM/6767033 to your computer and use it in GitHub Desktop.
Task3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <string> | |
#include <iostream> | |
#include <fstream> | |
using namespace std; | |
int main() | |
{ | |
string str,str1,str2,dopstr; | |
int count,i,j,k,pos,pos1,pos2; | |
ifstream fin; | |
ofstream fout; | |
fin.open("input.txt"); | |
fout.open("output.txt"); | |
while(getline(fin,str)) | |
{ | |
if (str.find("host") == 0) | |
{ | |
pos1 = 6; | |
while(str[pos1] == ' ') | |
{ | |
pos1++; | |
} | |
pos2=pos1; | |
while(str[pos2] != ' ') | |
{ | |
pos2++; | |
} | |
pos = str.find(" dns"); | |
str.erase(pos+1 ,4); | |
str = str.substr(0,pos1) + "dns "+str.substr(pos1); | |
} | |
fout<<str<<endl; | |
} | |
fout.close(); | |
fin.close(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment