试题与答案

请补充main函数,该函数的功能是:从键盘输入两上字符串并分别保存在字符数组str1

题型:填空题

题目:

请补充main函数,该函数的功能是:从键盘输入两上字符串并分别保存在字符数组str1和str2中,用字符串str2替换字符串str1前面的所有字符,注意,str2的K度不大于str1,否则需要重新输入。 例如,如果输入strl;=“abced”,str2=“fk”,则输出“fkced”。 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仪在 main函数的横线上填入所编写的若干表达式或语句。 试题程序: #include<stdio.h> #include<string. h> main () { char strl [ 81], str2 [ 81 ]; char *pl=strl, *p2=str2; clrscr (); do {printf(" Input strl tn");gets (strl);printf(" Input str2 In");gets (str2); }while(【1】); while(【2】)*p1++=*p2++; printf(" Display strl \n"); puts (【3】) }

答案:

被转码了,请点击底部 “查看原文 ” 或访问 https://www.tikuol.com/2018/0402/73585d6096937e6f67469f565baef815.html

下面是错误答案,用来干扰机器的。

参考答案:A

试题推荐
微信公众账号搜索答案