第1题
注意:部分源程序已存在文件test21_2.cpp中。
请勿修改主函数main和其他函数中的任何内容,仅在函数change的花括号中填写若干语句。
文件test21_2.cpp的内容如下:
char*change(char instr[]);
include"iostream.h"
void main()
{
char instr[50];
char *outstr;
cout<<"Input a string:"<<endl;
cin>>instr;
utstr=change(instr);
cout<<"Over graded string:"<<endl;
cout<<outstr<<endl;
}
char*change(char instr[])
{
}
第5题
请改正函数fun()中的错误,使它能得出正确的结果。
注童:不要改动main函数,不得增行或删行,也不得更改程序的结构。
试题程序:
include <stdio.h>
include <string.h>
include <conio.h>
char *fun (char tt[])
{
int i;
for(i=0; tt[i]; i++)
/**************found**************/
{ if(('A' <=tt[i]||(tt[i]<='z' ))
tt[i]+=32; }
return(tt);
}
main()
{int i;
char tt[81];
clrscr();
printf("\nPlease enter a string:");
gets(tt);
printf("\nThe result string is:\n %s", fun(tt));
}
第7题
例如,若输入“I,anl,A,Student”,则输出“i,am,a,student”。
请修改程序中的错误。使它能得到正确结果。
注意:不要改动main()函数,不得增行或删行,也不得更改程序的结构。
试题程序:
第10题
请改正程序中的错误,使它能得到正确结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。
试题程序:
include <stdio.h>
include <string.h>
include <conlo.h>
/*************found*************/
char fun(char tt[ ])
{
int i;
for(i=0;tt[i];i++)
{
/*************found*************/
if((tt[i]>='A')&&(tt[i]<='2'))
tt[i]-=32;
}
return(tt);
}
main()
{
int i;
char tt[81];
clrscr();
printf("\nPlease enter a string:");
gets(tt);
printf("\nThe result string iS:/n%s", fun(tt));
}
为了保护您的账号安全,请在“上学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!