更多"write.txt中,遇到回车键输入结束。。(用“/n”表示回车键)"的相关试题:
[填空题]以下程序运行时从键盘输入字符串ABCDE按回车键结束输入,使输入字符串中的A和B转换为字符#输出,其他字符输出为*。
#include"stdio.h"
main( )
{char c:
while((c=getchar( ))!=’/0’)
{switch(c)
{case’A’:
case’B’:putchar(’#’);break;
default:putchar(’*’);}
}
}
错误:______
改正:______
[填空题]请补充main函数,该函数的功能是:从键盘输入若干字符放到一个字符数组中,当桉回车键时结束输入,最后输出这个字符数组中的所有字符。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在 main函数的横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdio.h>
#include<ctype.h>
main( )
int i=0;
char a [81];
char *p=s;
clrscr ( );
printf" Input a string /n");
for (i=0; i<80; i++)
s [i] =getchar ( );
if (s [i]==’/n’)
【1】;
s[i]= 【2】
printf(" display the string /n");
while (*p)
putchar (【3】 );
[填空题]以下程序的功能是从键盘上输入若干个字符(以回车键作为结束)组成一个字符串存入一个字符数组,然后输出该字符数组中的字符串。
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______);
[单项选择]回车键
A. Telnet和FTP
B. Modem和ISDN
C. IE和Netscape
D. Outlook Express和Foxmail
E. Internet和Intranet
[填空题]在代码窗口中输入某行代码并按回车键后,如果代码变成红色,表示______。
[判断题]在Excel中,在单元格中输入的数据不能自动换行,必须人为输入回车键。
[判断题]绘制多段线,在命令行中输入Pline命令并按回车键
[填空题]请补充main函数,该函数的功能是:从键盘输入学生的成绩(用回车键作为分隔符),并统计各分数段学生的人数。具体要求为:A类为90~100分,B类为80~89分,C类为70~79分,D类为60~69分,59分以下的为E类。当成绩为0时结束成绩的输入,并且最后输入的0不进行统计。
例如,输入89,99,45,64,56,78,88,74,66,55,0。结果为
A:1 B:2 C://2 D://2 E://3
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在 main函数的横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdio.h>
#include<conio.h>
#define N 100
main( )
float score[N];
int bb[5];
int grade, i=-1,n=0;
char ch=’A’;
clrscr( );
printf("Input a score(0~100);/n");
do
i++;
n++;
printf("score[%d]=",i);
scanf ( 【1】 );
while (score[i]!=0);
for(i=0;i<5;i++)
【2】 ;
for(i=0;i<n-1;i++)
grade= 【3】 ;
switch(grade)
case 10:
case 9:bb[0]++;break;
case 8:bb[1]++;break;
case 7:bb[2]++;break;
case 6:bb[3]++; break;
default:bb[4]++;
[填空题]
下列过程的功能是:在对多个文本框进行输入时,对第一个文本框(text1)输入完毕后用回车键使焦点跳到第二个文本框(text2),而不是用TAB键来切换。请填空。
Private Sub [11] KeyDown(KeyCode As Integer,Shift As
Integer)
If KeyCode [12] vbKeyRetum
Then
Text2.SetFocus
End If
End
Sub
[填空题]下列过程的功能是:在对多个文本框进行输入时,对第1个文本框(text1)输入完毕后用回车键使焦点跳到第2个文本框(text2),而不是Tab键来切换。请完成该程序。
Private Sub Textl_(eyDown(Keycode As Integer,Shift As Integer)
If [14] Then
Text2. [15]
End If
End Sub