填空题
请补充main函数,该函数的功能是:从键盘出入一个字符串并保存在字符str1中,把字符串str1中下标为偶数的字符保存在字符串str2中并输出。
例如,当str1=”abcdefg”时,则str2=”aceg”。
注意:部分源程序给出如下
仅在横线上填入所编写的若干表达式或语句,请勿改动函数中的任何内容。
试题程序:
#include
#include
#defineLEN80
main()
{
charstr1[LEN],str2[LEN];
char*p1=str1,*p2=str2;
inti=0,j=0;
printf("Enterthestring:\n");
scanf(___1___);
printf("******theorigialstring********\n");
while(*(p1+j))
{
printf("___2___",*(p1+j));
j++;
}
for(i=0;i
*p2++=*(str1+i);
*p2='\0';
printf("\nThenewstringis:%s\n",___3___);
}
第1处填空:”%s”,str1
第2处填空:%c
第3处填空:str2