// This source and number (rhymes) permutation method apply to GNU General Public License. // Copyright (C) 2011 and later by Jasenko Dzinleski // This program is free software; you can redistribute it // and/or modify it under the terms of the GNU General Public License as // published by the Free Software Foundation; either version 2 of the // License, or (at your option) any later version. // This program is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // You should have received a copy of the GNU General Public License along // with this program; if not, write to the Free Software Foundation, Inc., // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // // Text Rhymes VRM 1.0.5 // written by Dzinleski Jasenko December , 1 , 2011 // #include #include #include char ip[256]="1234567890"; char ia[256]; char ib[256]="1111111111"; char iv[256];int ivi=0; char arga[256]; char s_a[256];int sai=0; char s_b[256];int sbi=0; char rp_f[256]; char rp_f_[256]; double p_val(char arr0[256]) { int sig=0; int j=0,k=0,l; long fr; int rvi; long long rvl; long long rvd; double rvd_; char arr1[256]; for(j=0;j='0'&&arr0[j]<='9')||(arr0[j]=='.'||arr0[j]==',')){arr1[l]=arr0[j];++l;}} for(j=0;j<256;++j){arr0[j]='\0';}l=0;for(j=0;j=0;--j) { ++l;rvl+=(long long)(-48+arr0[j])*pow(10,l); } rvi=(int)rvl; rvd_=(double)rvl; }else{ fr=0;l=-1; for(k=-1+strlen(arr0);k>j;--k) { ++l;fr+=(long)(-48+arr0[k])*pow(10,l); } rvd=0;l=-1; for(k=j-1;k>=0;--k) { ++l;rvd+=(long long)(-48+arr0[k])*pow(10,l); }rvd*=(long long)pow(10,strlen(arr0)-j-1); rvd_=(double)(rvd+(long long)fr)/(long long)pow(10,strlen(arr0)-j-1); } if(sig==0){return(rvd_);}else{return(-1.0*rvd_);} } double p_v(char pv_a1[256]) { bool df=false; int i,l; double p_v; p_v=0;l=-1; for(i=-1+strlen(pv_a1);i>=0;--i) { ++l;p_v+=(double)(-48+(int)pv_a1[i])*pow(10,l); if(df){printf("%d %e\n",-48+(int)pv_a1[i],pow(10,l));} } return(p_v); } int p_f_(double ar1) { int i,j,l,n; long long r,k,m,ti,tj; char ta[256];int tai=-1+256; for(i=0;i<256;++i){ta[i]='\0';} r=0;ti=10;tj=(long long)ar1; while(tj>0) { if((((long long)(tj/ti))*ti)-(((double)(tj/ti))*ti)==(double)0.00) {r=tj-((long long)(tj/ti))*ti;}else{r=tj-((long long)(tj/ti))*ti;--r;} tj-=r; //printf("!%c!",(48+(int)(r/(ti/10)))); ta[tai]=(48+(int)(r/(ti/(long long)10)));--tai; ti*=(long long)10; } for(j=0;j<256;++j){rp_f[j]='\0';} j=0;l=0;for(i=0;i<256;++i){if(j==0){if(ta[i]!='\0'){j=1;rp_f[l]=ta[i];++l;/*printf("%c",ta[i]);*/}}else{rp_f[l]=ta[i];++l;/*printf("%c",ta[i]);*/}}/*printf("\n");*/ return(0); } int p_f(double pf_r1) { bool df=false; int i,j; int l,l_,q; double pf_r1_; pf_r1_=pf_r1; for(i=0;i<256;++i){rp_f[i]='\0';}i=0; if(pf_r1==0){rp_f[i]='0';return(0);} l=0;while((pf_r1-pow(10,l))/(1000*pow(10,l))>10*(0.001)){++l;}l_=l;q=l; if(df){printf("%d %d\n",(int)(pf_r1/pow(10,l)),l );} if((int)(pf_r1/pow(10,l))<10) { rp_f[i]=48+(int)(pf_r1/pow(10,l));++i; if(df){printf("0.%d ",(int)(pf_r1/pow(10,l)));} }else{ rp_f[i]=48+(int)(pf_r1/pow(10,l))/10;++i; if(df){printf("1.%d ",(int)(pf_r1/pow(10,l))/10);} rp_f[i]=48+pf_r1/pow(10,l)-10*(int)((pf_r1/pow(10,l))/10);++i; if(df){printf("2.%d ",(int)(pf_r1/pow(10,l))-10*(int)(pf_r1/pow(10,l))/10);} } if(df){printf("?%s?\n",rp_f);} pf_r1=pf_r1-pow(10,l)*(int)(pf_r1/pow(10,l)); while(l>0) { l=0;while((pf_r1-pow(10,l))/(1000*pow(10,l))>10*(0.001)){++l;} if(df){printf("%e\n",(pf_r1-pow(10,l)*(int)(pf_r1/pow(10,l))));} j=l;while(j+1=0;--i){if(fm[i]=='.'){break;}}//decimal point point if(i==-1) { p_f_(ar1); l=-1+strlen(rp_f); if(strlen(rp_f)==0){while(m>=0){ar2[ar2i]=fm[m];--ar2i;--m;}}else{ while(l>=0){if(fm[m]==','){ar2[ar2i]=',';--ar2i;--m;}else{ ar2[ar2i]=rp_f[l];--l;--ar2i;--m;} } } while(m>=0){ar2[ar2i]=fm[m];--ar2i;--m;} }else{ p_f_(ar1); p_f_((ar1-p_v(rp_f))*pow(10,-1+strlen(fm)-i)); k=-1+strlen(rp_f); l=(m-i)-strlen(rp_f);while(l>0){ar2[ar2i]='0';--l;--ar2i;} while(k>=0&&ar2i>=256-(m-i)){ar2[ar2i]=rp_f[k];--k;--ar2i;} ar2[ar2i]='.';--ar2i;m=-1+i; p_f_(ar1); l=-1+strlen(rp_f); while(l>=0){if(m>=0&&fm[m]==',') {ar2[ar2i]=fm[m];--ar2i;--m;}ar2[ar2i]=rp_f[l];--l;--ar2i;--m;} while(m>=0&&ar2i>=n){ar2[ar2i]=fm[m];--ar2i;--m;} } }else{ p_f_(ar1); p_f_((ar1-p_v(rp_f))*pow(10,2)); k=-1+strlen(rp_f); l=2;i=0;while(k>=0||l>i){if(k>=0){ar2[ar2i]=rp_f[k];--k;--ar2i;--l;}else{ ar2[ar2i]='0';--ar2i;--l;}}ar2[ar2i]='.';--ar2i;m=1; p_f_(ar1); l=-1+strlen(rp_f); if(strlen(rp_f)==0){while(m>=0){ar2[ar2i]='0';--ar2i;--m;}}else{ while(l>=0){ar2[ar2i]=rp_f[l];--l;--ar2i;} } } l=0;if(sig==1){ar2[l]='-';++l;for(i=1;i<256;++i){if(ar2[i]!='\0'){ar2[l]=ar2[i];++l;}}}else{ for(i=0;i<256;++i){if(ar2[i]!='\0'){ar2[l]=ar2[i];++l;}} } for(i=l;i<256;++i){ar2[i]='\0';} for(i=0;i3) { for(i=0;i<256;++i){pa[i]='\0';} j=0;l=0;for(i=0;i