Here's the question.
http://postimg.org/image/nmqrupznp/

And here's my program,

#include <stdio.h>
#include <string.h>

void encrypt (char *text,char *map);
void decrypt (char *text,char *map);

int main()

{
int a,b;
char c[]="abcdefghijklmnopqrstuvwxyz";
char d[]="thequickbrownfxjmpsvlazydg";
char *text;
char *map;

text=&c[0];
map=&d[0];

printf ("Encrypt press 1;Decrypt press 0.\n");
scanf ("%d",&b);

if (b!=0&&b!=1)
    printf ("please enter 0 or 1.\n");
    printf ("Encrypt press 1;Decrypt press 0.\n");

if (b==1)
    encrypt (text,map);
else
    decrypt (text,map);


return 0;
}

void encrypt(char *text,char *map)
{
int x=1,c;
char a[100];
printf ("Enter a string for encryption.\n");
scanf ("%s",a[100]);
c=strlen(a);
char *z;
z=&a[0];

while (x<=c)
{
    if (*z==*text)
        {strcpy (z,map);
        printf ("%d",a[x]);
        text=text+1;
        z++;
        }
        else
                printf ("error input.");
                break;
        }
}

void decrypt(char *text,char *map)
{
int x=1,c;
char a[100];
printf ("Enter a string for encryption.\n");
scanf ("%s",a[100]);
c=strlen(a);
char *z;
z=&a[0];

while (x<=c)
{
    if (*z==*map)
        {strcpy (z,text);
        printf ("%d",a[x]);
        text=text+1;
        z++;
        }
         else
                printf ("error input.");
                break;
        }
}

-------------------
Can you guys help me on this?
On which part did I do wrong?

You need to put some work into your query. Tell us what input gives you what for the error.

Also, tell us what function the problem is in. That's easy baby steps to fixing programs, and thats a skill you will have to develop, in any language you work with.

Give us specific data, with specific input and errors, and practice some basic de-bugging skills. Nobody knows your program any better than you do, at this point, and everyone's time is valuable. Help us help you.

Even a basic added line which prints the questionable variable, along with a getchar() so you can stop to read it during program execution, will be enough to help pinpoint the error.

Of course, if you step through the program, watching the suspect variables values, you'll have an easier time of it.

looks like it is a bit over complicated for what you are after

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.