更多"以下程序的功能是将字符串s中的数字字符放入d数组中,最后输出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);
}
[填空题]以下程序的功能是将字符串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中的字符串。例如,输入字符串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) ;
[单项选择]以下程序企图把从终端输入的字符输出到名为abc.txt 的文件中,直到从终端读入字符#号时结束输入和输出操作,但程序有错。 #include <stdio.h> main( ) { FILE *fout; char ch; fout=fopen(’abc.txt’,’w’); ch=fgetc(stdin); while(ch!=’#’) { fputc(ch,fout); ch =fgetc(stdin); } fclose(fout); } 出错的原因是
A. 函数fopen调用形式有误
B. 输入文件没有关闭
C. 函数fgetc调用形式有误
D. 文件指针stdin没有定义
[填空题]以下程序的功能是:对输入的一行字符串的数字字符按它们的字面值累加,输出此累加和。例如,输入一行字符是:ab34dh8u,输出值应当是15。请填空。
#include <stdio.h>
#include <ctype.h>
main( )
char ch; int a,s;
______;
while((ch=getchar( ))______)
if( isdigit (ch))
a=______;s+=a;
printf("s=%d/n/n",s);
[单项选择]以下程序试图把从终端输入的字符输出到名为abc.txt的文件中,直到从终端读入字符#时结束输入和输出操作,但程序有错。 #include<stdio.h> main( ) { FILE *fout; char ch; fout=fopen(’abc.txt’,’W’); ch=fgetc(stdin); while (ch!=’#’) { fputc (ch,fout); ch=fgetc(stdin); } fclose (fout); } 出错的原因是( )。
A. 函数fopen调用形式错误
B. 输入文件没有关闭
C. 函数fgetc调用形式错误
D. 文件指针stdin没有定义
[单项选择]以下程序企图把从终端输入的字符输出到名为abc.txt的文件中,直到从终端读入字符#号时结束输入和输出操作,但程序有错。
#include <stdio.h>
main( )
{ FILE *fout; char ch;
fout=fopen(’’abc.txt’’,’’w’’);
ch=fgetc(stdin);
while(ch!=’’#’’)
{ fputc(ch,fout);
ch =fgetc(stdin);
}
fclose(fout);
}
出错的原因是( )。
A. 函数fopen调用形式有误
B. 输入文件没有关闭
C. 函数fgetc调用形式有误
D. 文件指针stdin没有定义