![](https://lstatic.shangxueba.com/jiandati/h5/images/m_q_title.png)
下列程序段中,正确的是______。①clssMvClss{ int vr = 100;sttic int getVr(); }②④ B.①③ C.② D.以上都不对
A.②④
B.①③
C.②
D.以上都不对
A.②④
B.①③
C.②
D.以上都不对
B.①③
C.②
D.以上都不对
下列给定的程序中,函数proc的功能是:判断字符ch 是,与str所指字符串中的某个字符相同;若相同,则什么也不做,若不同,则将其插在串的最后。请修改程序中的错误,使它能得出正确的结果。 注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。 试题程序: include include include include //****found**** void proc(char str,char ch) { while(*str &&*str!=ch)str++; //****found**** if(*str==ch) { str[0]=ch; //****found**** str[1]=0: } } void main { char str[81],ch; system("CLS"); printf("\nPlease enter a string:"); gets(str); printf("\n Please enter the character to search:"); ch=getchar; proc(str,ch); printf("\nThe result is%s\n",str); }
For I=1 To 3
Cls
Print "I=",I;
Next@答案@I=3@解析@本题考查Cls语句的功能。Cis语句的功能是清除窗体或其他对象上的所有输出,因此,本题在运行中虽然对I=1和I=2有输出,但都被清除,最后只剩下I=3时的输出值。
下列给定程序中,函数proc的功能是:读入一个字符串(长度<20),将该字符串中的所有字符按ASCII码升序排序后输出。 例如,输入opdye,则应输出deopy。 请修改程序中的错误,使它能得到正确结果。 注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。 试题程序: include include include include //****found**** int proc(char str[]) { char c; unsigned i,j; for(i=0;istr[j]) { c=str[j]: //****found**** str[j]=str[i++]; str[i]=c; } } void main { char str[81]; system("CLS"); printf("\nPlease enter a character string:"); gets(str); printf("\n\nBefore sorting:\n%s",str); proc(str); printf("\nAfter sorting decendingly:\n %s",str); }
下列给定程序中,函数proc的功能是:读入一个字符串(长度<20),将该字符串中的所有字符按ASCIl码升序排序后输出。 例如,输入opdye,则应输出deopy。 请修改程序中的错误,使它能得到正确结果。 注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。 试题程序: include%string.h> include%stdlib.h> include include //****found**** int proc(char str[]) { char C; unsigned i,j; for(i=0;istr[j]) { c=str[j]: //****found**** str[j]=str[i++]; str[i]=C; } } void main { char st/[81]; system("CLS"); printf("\nPlease enter a character string:"); gets(str); printf("\nknBefore sorting:\n %s",str); proc(str); printf("\nAfter sorting decendingly:\n %S",str); }
A.answer
B.obey
C.follow
D.respond
例如,输入498,则输出应该是161。
请修改程序中的错误,使它能得到正确结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。
试题程序:
include
include
include
long proc(10ng m)
{
//****found****
long sum=1;
do
{
sum+=(m%10)*(m%10);
m/=l0;
//****found****
}
while(m)
return(sum);
}
void main
{
long n;
system("CLS");
printf("Please enter a number:");
scanf("%1d",&n);
printf("\n%ld\n",proc(n));
}
为了保护您的账号安全,请在“简答题”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!