Guest User

Untitled

a guest
Apr 21st, 2018
61
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 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)
  2.     {
  3.     int i,min,step;
  4.     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};
  5.    
  6.     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)
  7.     first[8].start=-1;
  8.     for (i=0;i<15;i++)
  9.     {
  10.         if (first[i].start==-1)
  11.         {
  12.         }
  13.         else
  14.         {
  15.         min=first[i].start;
  16.         step=i;
  17.         break;
  18.         }
  19.     }
  20.    
  21.    
  22.     for (;i<15;i++)
  23.         if (((first[i].start<min)&&(first[i].start!=-1)))
  24.         {   min=first[i].start;
  25.             step=i;
  26.         }
  27.     return first[step];
  28. };
  29.     string* sort(string line)
  30.     {
  31.     string *process=new string[line.length()];
  32.     int i,j=0;
  33.    
  34.     if (line.find_last_of("=")!=line.find_first_of("="))
  35.         line.erase(line.find_first_of("="),line.find_last_of("=")-1);
  36.  
  37.     while (line.empty()==false)
  38.     {
  39.    
  40.         minimum first=min(line.find("sin"),line.find("cos"),line.find_first_of("0123456789"),line.find_first_of("*-+/"),line.find_first_of("()"),
  41.         line.find_first_of(","),line.find_first_of('x'),line.find_first_of('^'),line.find_first_of("QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm"),
  42.         line.find("log"),line.find("ln"),line.find("sqr"),line.find_first_of("="),line.find_first_of("."),line.find_first_of(";"));
  43.  
  44.     if (first.type=="Sin" || first.type=="Cos" || first.type==("Log") || first.type==("Sqr"))
  45.         {
  46.             for (i=first.start;i<3;i++)
  47.                 process[j]+=line[i];
  48.                 j++;
  49.         }
  50.    
  51.     if (first.type==("Ln"))
  52.         {
  53.             for (i=first.start;i<2;i++)
  54.                 process[j]+=line[i];
  55.                 j++;
  56.         }
  57.    
  58.     if (first.type=="Sign" || first.type=="Staple" || first.type=="X" || first.type=="Exent" || first.type=="Exent"|| first.type=="Equally" || first.type=="Semicolon")
  59.         {
  60.             i=first.start;
  61.             process[j]+=line[i];
  62.             j++;
  63.         }
  64.                
  65.     if (first.type=="Number" || first.type=="Comma" || first.type=="Dot")
  66.         {  
  67.             if (line.find_first_not_of("0123456789,.")!=-1)
  68.             first.end=line.find_first_not_of("0123456789,.");
  69.             else
  70.             first.end=line.length();
  71.             if (line.find_first_of(',')!=-1)
  72.                 line[line.find_first_of(',')]='.';
  73.             for (i=first.start;i<first.end;i++)
  74.             {
  75.                 process[j]+=line[i];
  76.             }
  77.        
  78.     j++;
  79.         }
  80.     if (first.type=="Letter")
  81.     {
  82.         i=first.start;
  83.         if (line[i]>96 && line[i]<123)
  84.             line[i]-=32;
  85.        
  86.         process[j]+=line[i];
  87.         j++;
  88.     }
  89.     line.erase(first.start,first.end);
  90.     }
  91. AmountTmp=j;
  92.  
  93. return process;
  94.     };
RAW Paste Data