更多"【说明】 以下程序的功能是:从键盘上输入一个字符串,把该字符串中的小"的相关试题:
[填空题]以下程序的功能是从键盘上输入一行字符,存入一个字符数组中,然后输出该字符串。请填空。
main( )
char str[81],*sptr;
int i;
for(i=0;i<80;i++)
str[i]=getchar( );
if(str[i]==’/n’)break;
str[i]= 【10】 ;
sptr=str1
while(* sptr)putchar(* sptr 【11】 );
[填空题]以下程序的功能是从键盘上输入若干个字符(以回车键作为结束)组成一个字符串存入一个字符数组,然后输出该字符数组中的字符串。
main( )
char str[51],*sptr;
int i;
for(i=0;i<50;i++)
str[i]=getchar( );if(str [j]==’/n’)______;
str[i]:______;
sptr=str;
while(*sptr)putchar(*sptr______);
[填空题]下列程序用来将从键盘上输入的2个字符串进行比较,然后输出2个字符串中第1个不相同字符的ASCII码之差。例如,输入的2个字符串分别为abcdef和abceef,则输出为-1。
#include
main ( )
char str [100], str2 [100], c;
int i,s;
printf("/n input string 1:/n"); gest(str1);
printf("/n input string 2:/n"); gest(str2);
i=0;
while((strl[i]==str2[i]&&(strl[i]!= 【6】 ))
i++;
s= 【7】 ;
printf(.%d/n",s);
[单项选择]以下程序试图把从终端输入的字符输出到名为abc.txt的文件中,直到从终端读入字符串#号时结束输入和输出操作,但程序有错
#include<stdio.h>
main( )
FILE*fout;
char ch;
fout=fopen(’abc.txt’,’w’);
ch=fgetc(stdin);
while(ch!=’#’)
fputc(ch,four);
ch=fgetc(stdin);
fclose(fout);
出错的原因是______。
A. 函数fopen调用形式错误
B. 输入文件没有关闭
C. 函数fgetc调用形式错误
D. 文件指针stdin没有定义
[简答题][说明]
以下C程序实现了将字符串转化为浮点数的功能。例如字符串“1234567”转化为浮点数1234567;字符串“100.02035”转化为浮点数100.02035;字符串“-100.02035”转化为浮点数-100.02035。程序中的部分变量的含义如表9-5。
表9-5 变量名 | 含 义 |
intpart | 字符串转化为浮点数后的整数部分 |
doublepart | 字符串转化为浮点数后的小数部分 |
kdouble | 记录小数部分的阶次 |
resoult | 字符串转化为浮点数后的
[简答题][说明] 以下C程序实现了将字符串转化为浮点数的功能。例如字符串“1234567”转化为浮点数1234567;字符串“100.02035”转化为浮点数100.02035;字符串“-100.02035”转化为浮点数-100.02035。程序中的部分变量的含义如表9-5。 表9-5
变量名 |
含 义 |
intpart |
字符串转化为浮点数后的整数部分 |
doublepart |
字符串转化为浮点数后的小数部分 |
kdouble |
记录小数部分的阶次 |
resoult |
字符串转化为浮点数后的结果
[填空题]以下程序的功能是将字符串s中的数字字符放人d数组中,最后输出d中的字符串。例如,输入字符串abc123edf456gh,执行程序后输出123456。请填空。
# include<stdio. h>
# include<ctype. h>
main( )
{ char s[80], d[80]; int i, j;
gets(s);
for(i=j=0; s[i]!=’/0’; i++)
if( 【6】 ){ d[j]=s[i]; j++;)
d[j]=’/0’;
puts(D) ;
}
[填空题]以下程序的功能是将字符串s中的数字字符放入d数组中,最后输出d中的字符串。
例如,输入字符串:abc123edf456gh,执行程序后输出:123456。请填空。
#include <stdio.h>
#include <ctype.h>
main( )
{ char s[80],d[80]; int i,j;
gets(s);
for(i=j=0;s[i]! =’/0’;i++)
if( 【9】 ) {d[j]=s[i]; j++;}
d[j]=’/0’;
puts(d);
}
[填空题]以下程序的功能是将字符串s中的数字字符放入d数组中,最后输出d中的字符串。例如,输入字符串:abcl23edf456gh,执行程序后输出:123456。请填空。 #include <stdioo.h> #include <ctype.h> main( ) char s[80],d[80]; int i,j; gets(s); for(i=j=0;s[i]!=’/0’;i++) if( 【20】 )d[j]=s[i];j++; d[j]=’/0’; puts(d);
[填空题]以下程序的功能是将字符串s中的数字字符放入d数组中,最后输出d中的字符串。例如,输入字符串: abcl23edf456gh,执行程序后输出:123456。请填空。 #include<stdio.h> #include<ctype,h> main( ) char s[80],d[80];int i,j; gets(s); for(i=j=0;s[i]!=’/0’;i++) if(______)d[j]=s[i];j++; d[j]=’/0’; puts(d) ;
[填空题]以下程序的功能是将字符串s中的数字字符放入d数组中,最后输出d中的字符串。例如,输入字符串 :abc123edf456gh,执行程序后输出:123456请填空. #include <stdio.h> #include <ctype.h> main( ) char s[80], d[80]; int i,j; gets(s); for (i=j=0;s[i]!=’/0’;i++) if( ) d[j]=s[i]; j++; d[j]=’/0’; puts (d);
[填空题]以下程序中函数 huiwen 的功能是检查一个字符串是否是回文,当字符串是回文时,函数返回字符串 yes!,否则函数返回字符串 no!,并在主函数中输出,所谓 回文即正向与反向的拼写都一样,例如:adgda。请填空。
#include
char *huiwen(char *str)
{ char *p1,*p2; int i,t=0;
p1=str;p2==_______ ;
for(i=0;i<=strlen(str)/2;i++)
if(*p1++!=*p2--){t=1;break;}
if(=_______ ) return("yes!");
}
main( )
else return("no!");
{ char str[50];
printf("Input:"); scanf("%s",str);
printf("%s/n",=_______ );
}
购买搜题卡查看答案
[会员特权] 开通VIP, 查看 全部题目答案
[会员特权] 享免全部广告特权
请选择支付方式
-
微信支付
-
支付宝支付
立即支付
系统将自动为您注册账号
请使用微信扫码支付
请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码
| |