Implementation code:
#include <stdio.h>
void Main ()
{
void Jiami ();
void Jiemi ();
int C;
printf ("==============================/n");
printf ("Shift cipher Encryption System/n");
printf ("Input 1 Select Encryption | | Input 0 Select decrypt/n ");
printf ("==============================/n");
printf ("Please select:");
scanf ("%d", &c);
if (c==1)
Jiami ();
Else
Jiemi ();
}
void Jiami ()
{
int a[100],b[100],i,n,k;
printf ("Please enter the number of characters you want to encrypt:");
scanf ("%d", &n);
printf ("Please enter the encryption key:");
scanf ("%d", &k);
printf ("Please enter a Cryptographic object:");
for (i=0;i<n;i++)
scanf ("%d", &a[i]);
for (i=0;i<n;i++)
{
b[i]= (a[i]+2)%26+65;
printf ("%5c", B[i]]);
}
printf ("/n");
}
void Jiemi ()
{
int a[100],b[100],c[100],i,n,k;
printf ("Please enter the number of characters to decrypt:");
scanf ("%d", &n);
printf ("Please enter the decryption key:");
scanf ("%d", &k);
printf ("Please enter the decrypted object:");
for (i=0;i<n;i++)
scanf ("%d", &a[i]);
for (i=0;i<n;i++)
{
b[i]= (a[i]-k)%26;
if (b[i]<0)
c[i]=b[i]+26+65;
Else
c[i]=b[i]+65;
printf ("%5c", C[i]);
}
printf ("/n");
}
This code is written by itself, published here mainly want to get expert guidance, such as: Do not need to enter the number of encryption characters, code How to change more reasonable.