更多"键入一串字符(换行作为结束标志),统计字符的个数,将该串字符及字符个数"的相关试题:
[填空题]键盘键入字符串并在计算机屏幕上显示,这时的数据源是【 】。
[填空题]键盘键入字符串并在计算机屏幕上显示,这时的数据源是 【13】 。
[填空题]字符型常量也称为字符串,它是由字符串"定界符"括起来的一串字符,定界符可以是单引号、双引号或()
[简答题]【说明】
单击窗体上的“测试”(cmdTest)按钮,出现一个输入框,要求输入一串字符,将该字符串中的非字母字符删除后,显示在窗体中的一个文本框(txtShow)中。
【程序代码】
Private Sub cmdTest_Click( )
Dim strT1 ,strT2 As String
Dim strCh As (1)
Dim intL As Integer
Dim intl As Integer
strT1 = (2) ("请输入一串字符","字符串输入")
intL = (3)
strT2 = " "
For intl = I To intL
strCh = Mid ( strT1, intl, 1 )
If(strCh>"A"And (4) ) Or (strCh >"a" And suCh <"z" )Then
strT2 = strT2 + strCh
End If
Next intl
txtShow. Text= (5)
End sub
[判断题]Excel中,如果把一串阿拉伯数字作为字符而不是数值输入,应当在数字前加双引号“””。( )
A. 正确
B. 错误
[填空题]从键盘输入一串字符(“*”作为结束标志),将其写入文本文件file.dat中保存。
#include<stdio.h>
#include<stdlib.h>
main( )
char ch;
FILE *fp;
if((fp=fopen("file.dat","______")):=NULL)
printf("Can not open file/n");exit(0);
ch=getchar( );
while (ch!=’*’)
fputc(______,fp);
ch=getchar( );
fclose(______);
[填空题]从键盘输入一串字符("#"作为结束标志),将其写入文本文件file.dat中保存。
#include<stdio.h>
#include<stdlih.h>
main( )
{char ch;
FILE*fp:
if((fp=fopen("file.det","______"))==NULL)/*第一空*/
{printf("Can not open file/n");exit(0);}
ch=getchar( );
whil(ch!’#’)
{fputc(______,fp);/*第二空*/
ch=getchar( );
}
fclose(______); /*第三空*/
}
[不定项选择]如果在文本框内输入英文,则必须在输入到块内最右端时键入()才能换行,如果不键入,则后面输入的内容就会与前面所输入内容重叠在一起。
A. 回车键
B. shift键
C. ESC键
D. 空格键
[填空题]下列给定程序中,函数fun( )的功能是:删除字符串s中所有空白字符(包括Tab字符、回车符及换行符)。输入字符串时用’#’结束输入。
请改正程序中的错误,使它能得出正确的结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构.
试题程序:
#include <string.h>
#include <stdio.h>
#include <ctype.h>
fun(char *p)
{ int !i, t; char c[80];
for(i=0,t=0;p[i];i++)
if(!isspace(*(p+i))) c[t++]=p[i];
/**********************************/
c[t]=’/0’;
strcpy(p,c);
}
main( )
{char c,s[80];
int i=0;
printf("Input a string: ");
c=getchar( );
while(c!=’#’)
( s[i]=c;i++;c=getchar( );}
s[i]="/0";
fun(s);
puts(s);
{
[单项选择]在Java中,表示换行符的转义字符是( )。