Skip to content
Permalink
main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
1 contributor

Users who have contributed to this file

41 lines (36 sloc) 1.25 KB
#include <list>
#include <string>
#include <vector>
#include <iostream>
#include <fstream>
#include <time.h>
#include <stdlib.h>
#define basemax 50
#define sizek 25
// code base
// explores a lresu file
// sends the found PRPs to cerr and the other ones to sout
using namespace std;
using sint=long unsigned int; // std::vector<std::__cxx11::basic_string<char> >::size_type;
ifstream lresu;
int main(int argc, char *argv[])
{string l,p,exp,ms,prefms,s1,s2; sint i,j; char ss;
ms=argv[1];
prefms="lresu"+ms+"00.txt";lresu.open(prefms.c_str());p="";
while(getline(lresu,l))
{for(i=0;i<l.length();i++)if(l.substr(i,5)==":ABC ")
{cout<<p;p=l.substr(0,i)+"\n";break;}
for(i=0;i<l.length();i++)if((l.substr(i,14)=="Frobenius PRP!")||(l.substr(i,9)=="is prime!"))
{for(j=0;j<l.length();j++)if(l[j]=='^')
{exp="^";for(j=j+1;j<l.length();j++)if(l[j]=='+'||l[j]=='-')break;else exp+=l[j];
for(j=0;j<p.length();j++)if(p[j]=='}')
{l=p.substr(0,j)+exp+p.substr(j,p.length());
for(i=0;i<l.length();i++)if(l[i]=='{')l[i]='(';else if(l[i]=='}')l[i]=')';
cerr<<l;
}
p="";break;
}
}
}
cout<<p;
} // end main