题目
一道程序改错题.求高手.
编写按如下规则进行字母变换的函数,把第一行中的
小写字母变成第二行中对应的大写字母
原a b c d e f g h i j k l m n o p q r s t u v w x y z
新C A L V I B MWP D NX H F O Y E GQZ R J T S K U
通过main函数调用该函数对上述字符串进行变换,并
统计字符串长度及变换后的字符串中每个字母出现的
次数,输出变换后的字符串和统计结果
程序如下:
#include
main()
{
char *s1="successindealingwithunknownciphersismeasuredbythesefourthingsintheordernamedperseverancecarefulmethodsofanalysisintuitionlucktheabilityatleasttoreadthelanguageoftheoriginaltextisverydesirablebutnotessential";
char *s2;
int a[26];
int i,l;
l=strlen(s1);
s2=(char *)malloc(sizeof(char)*l);
printf("%d \n",l);
i=0;
while( s1[i]!='\0')
{
replace(sa,sb);
i++;
}
printf(" %s", s2);
for (i=0;i
编写按如下规则进行字母变换的函数,把第一行中的
小写字母变成第二行中对应的大写字母
原a b c d e f g h i j k l m n o p q r s t u v w x y z
新C A L V I B MWP D NX H F O Y E GQZ R J T S K U
通过main函数调用该函数对上述字符串进行变换,并
统计字符串长度及变换后的字符串中每个字母出现的
次数,输出变换后的字符串和统计结果
程序如下:
#include
main()
{
char *s1="successindealingwithunknownciphersismeasuredbythesefourthingsintheordernamedperseverancecarefulmethodsofanalysisintuitionlucktheabilityatleasttoreadthelanguageoftheoriginaltextisverydesirablebutnotessential";
char *s2;
int a[26];
int i,l;
l=strlen(s1);
s2=(char *)malloc(sizeof(char)*l);
printf("%d \n",l);
i=0;
while( s1[i]!='\0')
{
replace(sa,sb);
i++;
}
printf(" %s", s2);
for (i=0;i
提问时间:2021-02-20
答案
写得太繁琐.错得较多.由于是26个顺序的小写字母翻译,可以简单地实现:char t[]="CALVIBMWPDNXHFOYEGQZRJTSKU"; // 翻译表void replace(char *a,char *b) { *b=t[ *a-'a'];} // 翻译可以统计翻译前的字母出现个数,打...
举一反三
已知函数f(x)=x,g(x)=alnx,a∈R.若曲线y=f(x)与曲线y=g(x)相交,且在交点处有相同的切线,求a的值和该切线方程.
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
奥巴马演讲不用看稿子.为什么中国领导演讲要看?
想找英语初三上学期的首字母填空练习……
英语翻译
最新试题
- 17位老师带领46名学生到公园游玩.怎样购票最合算?共需要多少钱?成人:30元,学生:15元,团体:18元(30人以上
- 2句型转换(就括号部分提问)
- 3一个长方形的面积是0.15公顷,长和宽的比5:3,这块地的周长是多少?
- 4计算不定积分 ∫arcsin xdx
- 5母亲说;我的年龄是女儿的4倍,我是27岁生的这个女儿.母女俩今年的年龄各是多少岁?请用一元一次方程
- 6留恋,留念,怀恋,怀念,分别是什么意思?
- 7n(180n-360)除以360n等于多少
- 8将下列成语按要求分类
- 9每当我因取得成绩而骄傲的时候爸爸总是这样对我说的实诗句
- 10can you speak much louder=can you speak more loudly
热门考点