Patrunjel Posted February 15, 2012 Report Posted February 15, 2012 A postat careva niste loguri, si ma plictiseam, si am inceput sa scanez ca handicapatu ip-urile victimelor. Asa ca am facut asta #include<iostream>#include<fstream>#include<string.h>#include<stdlib.h>using namespace std;ifstream fin("loguri");ofstream fout("ip-uri");char t1[]="Ip:",t2[100],t3[100];bool gasit[4][256];void adaug(char t3[100]){ int ip[4]={0},cont=0,nr=0,i,j; char ch[3]; bool ok=0; for(i=0;t3[i]!='\0';i++){ if(t3[i]=='.'){ ip[cont]=atoi(ch); cont++; nr=0; for(j=0;j<3;j++) ch[j]='f'; } else{ ch[nr]=t3[i]; nr++; } } ip[cont]=atoi(ch); for(i=0;i<4;i++){ if(!gasit[i][ip[i]]) ok=1; gasit[i][ip[i]]=1; } if(ok){ fout<<ip[0]; for(i=1;i<4;i++) fout<<"."<<ip[i]; fout<<endl; }}int main(){ int i; while(!fin.eof()){ fin>>t2; if(!strcmp(t1,t2)){ fin>>t3; adaug(t3); } } return 0;}E departe de-a fi optimizat sau macar scris frumos, dar isi face treaba, si pentru 11k linii (nustiu cat vine in loguri, sunt in formatul in care exporta istealer, plm) a terminat in sub 0.1s, pe un netbook slobozit la 1.8Ghz.Plm, sper sa ajute pe cineva.*Sunt curios cate pot sa adun, daca aveti loguri (vechi, nu ma intereseaza logurile in sine), dati si voi un link de dl Quote
Starker Posted February 15, 2012 Report Posted February 15, 2012 Nice one ! Atat de simplu si totusi destul de practic. Quote