马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
随便写个简单C语言程序
#include<stdio.h>
void jiami(char sn);
#define MAX 40
int main()
{
int i;
char a[MAX];
printf("输入原文:");
scanf("%s", a);
printf("输出密文:\n");
for (i = 0; i <= MAX; i++)
{
if(a[i] == '\0')
break;
else
//printf("%c", a[i]);
jiami(a[i]);
if(((i + 1) % 4) == 0)
putchar('\n');
}
return 0;
}
void jiami(char sn)
{
switch (sn)
{
case 'a': printf("·- "); break;
case 'b': printf("-··· "); break;
case 'c': printf("-·-· "); break;
case 'd': printf("-·· "); break;
case 'e': printf("· "); break;
case 'f': printf("··-· "); break;
case 'g': printf("--· "); break;
case 'h': printf("···· "); break;
case 'i': printf("·· "); break;
case 'j': printf("·--- "); break;
case 'k': printf("-·- "); break;
case 'l': printf("·-·· "); break;
case 'm': printf("-- "); break;
case 'n': printf("-· "); break;
case 'o': printf("--- "); break;
case 'p': printf("·--· "); break;
case 'q': printf("--·- "); break;
case 'r': printf("·-· "); break;
case 's': printf("··· "); break;
case 't': printf("- "); break;
case 'u': printf("··- "); break;
case 'v': printf("···- "); break;
case 'w': printf("·-- "); break;
case 'x': printf("-··- "); break;
case 'y': printf("-·-- "); break;
case 'z': printf("--·· "); break;
case '1': printf("·---- "); break;
case '2': printf("··--- "); break;
case '3': printf("···-- "); break;
case '4': printf("····- "); break;
case '5': printf("····· "); break;
case '6': printf("-···· "); break;
case '7': printf("--··· "); break;
case '8': printf("---·· "); break;
case '9': printf("----· "); break;
case '0': printf("----- "); break;
}
}
|