求C语言程序题要有答案的
来源:百度知道 编辑:UC知道 时间:2024/09/24 00:44:33
1、 编程实现对键盘输入的英文名句子进行加密。用加密方法为,当内容为英文字母时其在26字母中的其后第三个字母代替该字母,若为其它字符时不变。
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void main()
{
char str[1024];
int i=0;
printf("请输入一串字符:");
scanf("%s",str);
while(str[i]!='\0')
{
if((str[i]>='a'&&str[i]<='w')||(str[i]>='A'&&str[i]<='W'))
str[i]+=3;
else if((str[i]>='x'&&str[i]<='z')||(str[i]>='X'&&str[i]<='Z'))
str[i]=str[i]-26+3;
i++;
}
printf("加密后的字符串为%s\n",str);
}
2、 编程实现将任意的十进制整数转换成R进制数(R在2-16之间)。
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
void