#include<stdio.h>
#include<string.h>
char string[100];
char ch,ch1;
int i,j;
int sum=0;
void tongji();
void daoxu();
void zhuanhuan();
void jiami();
void lianjie();
void tongji()
{
printf("请输入你要查找的字母:");
//ch1=getchar();
scanf("%d",&ch1);
ch = getchar();
for(i=0;i<100;i++)
if(string[i]== ch1)
sum++;
printf("總共有%d個%c\n",sum,ch);
}
/*
void daoxu()
{
char string[100];
char ch;
char ch1;
int i,j;
for(j=0;j<i/2;j++)
{
ch1=string[j];
string[j]=string[i-1-j];
string[i-1-j]=ch1;
}
for(i=0;i<100;i++)
printf("%c",string[i]);
}
void zhuanhuan()
{
for(j=0;j<i;j++)
if(string[j]>='a'&&string[j]<='z')
string[j]=string[j-32];
else string[j]=string[j]+32;
for(i=0;i<100;i++)
printf("%c",string[i]);
}
void jiami()
{
printf("請輸入原字符串的內容\n");
scanf("%d",&i);
gets(ch);
encryp(ch,ch1);
puts(ch);
}
void lianjie()
{
i=0,j=0;
printf("第一个字符串:");
scanf("%s",s1);
printf("第二个字符串:");
scanf("%s",s2);
while (s1[i] !='\0')
i++;
while (s2[j] !='\0')
s1[i++]=s2[j++];
s1[i] ='\0';
printf("连接后: %s\n",s1);
}*/
void main()
{
printf("********************欢迎进入字符串管理系统****************\n\n");
int select;
for ( i = 0; i < 100; i++ )
string[i] = ' ';
putwchar('?');
printf("请输入原字符串内容:\n");
while ( (ch = getchar()) !='\n' )
{
string[i]=ch;
i++;
}
while(1)
{ printf("**************************************************\n");
printf("* 操 作 选 项 *\n");
printf("* 1:统计字符串 *\n");
printf("* 2:倒序字符串 *\n");
printf("* 3:转换字符串 *\n");
printf("* 4:加密字符串 *\n");
printf("* 5:連接字符串 *\n");
printf("**************************************************\n");
printf("请输入选项(1到5).==>");
scanf("%d",&select);
switch (select)
{
case 1:
tongji();
break;
/*case 2:
daoxu();
break;
case 3:
zhaunhuan();
break;
case 4:
jiami();
break;
case 5:
lianjie();
break; */
}
}
}
加密函数中加密的规律是什么?
最新推荐文章于 2023-01-31 21:05:56 发布