Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- minimum min(int sin,int cos,int number, int sign,int staple,int comma, int x, int exent, int letter,int log, int ln,int sqr, int equally, int dot, int semicolon)
- {
- int i,min,step;
- minimum first[]={sin,"Sin",sin+3,cos,"Cos",cos+3,number,"Number",number+1,sign,"Sign",sign+1,staple,"Staple",staple+1,comma,"Comma",comma+1,x,"X",x+1,exent,"Exent",exent+1,letter,"Letter",letter+1,log,"Log",log+3,ln,"Ln",ln+2,sqr,"Sqr",sqr+3,equally,"Equally",equally+1,dot,"Dot",dot+1,semicolon,"Semicolon",semicolon+1};
- if (first[0].start == first[8].start || first[1].start == first[8].start || first[9].start == first[8].start || first[10].start == first[8].start || first[11].start == first[8].start)
- first[8].start=-1;
- for (i=0;i<15;i++)
- {
- if (first[i].start==-1)
- {
- }
- else
- {
- min=first[i].start;
- step=i;
- break;
- }
- }
- for (;i<15;i++)
- if (((first[i].start<min)&&(first[i].start!=-1)))
- { min=first[i].start;
- step=i;
- }
- return first[step];
- };
- string* sort(string line)
- {
- string *process=new string[line.length()];
- int i,j=0;
- if (line.find_last_of("=")!=line.find_first_of("="))
- line.erase(line.find_first_of("="),line.find_last_of("=")-1);
- while (line.empty()==false)
- {
- minimum first=min(line.find("sin"),line.find("cos"),line.find_first_of("0123456789"),line.find_first_of("*-+/"),line.find_first_of("()"),
- line.find_first_of(","),line.find_first_of('x'),line.find_first_of('^'),line.find_first_of("QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm"),
- line.find("log"),line.find("ln"),line.find("sqr"),line.find_first_of("="),line.find_first_of("."),line.find_first_of(";"));
- if (first.type=="Sin" || first.type=="Cos" || first.type==("Log") || first.type==("Sqr"))
- {
- for (i=first.start;i<3;i++)
- process[j]+=line[i];
- j++;
- }
- if (first.type==("Ln"))
- {
- for (i=first.start;i<2;i++)
- process[j]+=line[i];
- j++;
- }
- if (first.type=="Sign" || first.type=="Staple" || first.type=="X" || first.type=="Exent" || first.type=="Exent"|| first.type=="Equally" || first.type=="Semicolon")
- {
- i=first.start;
- process[j]+=line[i];
- j++;
- }
- if (first.type=="Number" || first.type=="Comma" || first.type=="Dot")
- {
- if (line.find_first_not_of("0123456789,.")!=-1)
- first.end=line.find_first_not_of("0123456789,.");
- else
- first.end=line.length();
- if (line.find_first_of(',')!=-1)
- line[line.find_first_of(',')]='.';
- for (i=first.start;i<first.end;i++)
- {
- process[j]+=line[i];
- }
- j++;
- }
- if (first.type=="Letter")
- {
- i=first.start;
- if (line[i]>96 && line[i]<123)
- line[i]-=32;
- process[j]+=line[i];
- j++;
- }
- line.erase(first.start,first.end);
- }
- AmountTmp=j;
- return process;
- };
Add Comment
Please, Sign In to add comment