You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
850 B

#include <stdio.h>
/********** Begin **********/
void change(char *string,int d[],int l,int n4)
{
int x=0,z=l;
char temp;
for(x=0;x<n4;x++)
{
l=z;
temp=*(string+d[l]);
for(;l>=1;l--)
{
*(string+d[l])=*(string+d[l-1]);
}
*(string+d[0])=temp;
}
}
void Dec(char *str,int n1,int n2,int n3)
{
int i=0,j=0,k=0,n=0;//,x=0,y=0,z=0,temp;
int a[50],b[50],c[50];
while(*str!='\0')
{
if (*str>= 'a' && *str<= 'i')
{
a[i++]=n;
}
else if (*str>= 'j' && *str<= 'r')
{
b[j++]=n;
}
else if ((*str>='s' && *str<='z')||*str=='_')
{
c[k++]=n;
}
n++;
str++;
}
i--;j--;k--;
str=str-n;
change(str,a,i,n1);
change(str,b,j,n2);
change(str,c,k,n3);
printf("%s\n",str);
}
/********** End **********/