Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<string.h>
- int main()
- {
- char inp[100]={0}, cdr[]="AAEEIIOOUUAABCDFGHJKLMNPQRSTVWXYZBCaaeeiioouuaabcdfghjklmnpqrstvwxyzbc";
- int c,i,j,len;
- X:
- printf("Enter String: ");
- gets(inp);
- len=strlen(inp);
- printf("Enter 1 to Encode\nEnter 2 to Decode\nEnter 0 to Exit\nEnter Your Choice: ");
- scanf("%d",&c);
- if(c==1)
- {
- for(i=0 ; i<len ; i++)
- {
- if((inp[i]<65) || (inp[i]>122) || (inp[i]>90 && inp[i]<97))
- printf("%c", inp[i]);
- else
- for(j=0 ; j<64 ; j++)
- if(inp[i]==cdr[j])
- {
- printf("%c",cdr[j+2]);
- break;
- }
- }
- printf("\n");
- goto X;
- }
- else if(c==2)
- {
- for(i=0 ; i<len ; i++)
- {
- if((inp[i]<65) || (inp[i]>122) || (inp[i]>90 && inp[i]<97))
- printf("%c", inp[i]);
- else
- for(j=2 ; j<68 ; j++)
- {
- if(j==35)
- j=37;
- if(inp[i]==cdr[j])
- {
- printf("%c",cdr[j-2]);
- break;
- }
- }
- }
- printf("\n");
- goto X;
- }
- else if(c==0)
- goto Z;
- else
- {
- printf("Wrong input. Try Again\n\n");
- goto X;
- }
- Z:
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement