00330038003000301585065781559 关于 下列 while 语句,以下说法错误的是? TempStr = input("请输入带有符号的温度值: ") while TempStr[-1] not in ['N','n']:print(TempStr) TempStr = input("请输入带有符号的温度值: ") print("程序结束")A.while 是循环语句的一种类型。#B.while 后面的表达式为真(True)时执行 while 下面缩进的语句块: print(TempStr) TempStr = input("请输入带有符号的温度值: ")#C.while 后面的表达式为假(False)时执行 while 下面缩进的语句块: print(TempStr) TempStr = input("请输入带有符号的温度值: ")#D.该循环在用户输入的 字符串的最后一个字符是 'N' 或 'n' 时,退出循环,执行while 后面面语句块:print("程序结束")
00330038003000301585065781559 关于 下列 while 语句,以下说法错误的是? TempStr = input("请输入带有符号的温度值: ") while TempStr[-1] not in ['N','n']:print(TempStr) TempStr = input("请输入带有符号的温度值: ") print("程序结束")
A.while 是循环语句的一种类型。#B.while 后面的表达式为真(True)时执行 while 下面缩进的语句块: print(TempStr) TempStr = input("请输入带有符号的温度值: ")#C.while 后面的表达式为假(False)时执行 while 下面缩进的语句块: print(TempStr) TempStr = input("请输入带有符号的温度值: ")#D.该循环在用户输入的 字符串的最后一个字符是 'N' 或 'n' 时,退出循环,执行while 后面面语句块:print("程序结束")参考答案和解析
A
相关考题:
下列程序的执行结果为Private Sub Command1_Click()Dim s1 As String, s2 As Strings1= "abcd"Call Transfer(s1, s2)Print s2End SubPrivate Sub Transfer (ByVal xstr As String, ystr As String)Dim tempstr As Stringi=Len(xstr)Do While i =1tempstr=tempstr + Mid(xstr, i, 1)i=i - 1Loopystr=te mpstrEnd Sub( )。A.dcbaB.abdcC.abcdD.dabc
单击窗体时,下列程序的执行结果是Private Sub Invert(ByVal xstr As String, ystr As String)Dim tempstr As StringDim I As IntegerI=Len(xstr)Do While I =1tempstr=tempstr + Mid(xstr, I, 1)I=I - 1Loopystr=tempstrEnd SubPrivate Sub Form_Click()Dim s1 As String, s2 As Strings1= "abcdef"Invert s1, s2Print s2End Sub( )。A.abcdefB.afbecdC.fedcbaD.defabc
窗体上有一个Text1文本框,一个Command1命令按钮,并有以下程序Private Sub Command1_click()Dim 11If Textl.Text”123456”Thenn=n+1print“口夸输入错误”&n&次”End IfEnd Sub希望程序运行时得到左图所示的效果,即:输入口令,单击“确认口令”命令按钮,若输入的口令不是“123456”,则在窗体上显示输入错误口令的次数。但上面的程序实际显示的是右图所示的效果,程序需要修改。下面修改方案中正确的是A.在Dim n语句的下面添加一句:n=OB.把Print“口令输入错误”&n&“次”改为Print“口令输入错误”+n+“次”C.把Print“口令输入错误”&n&“次”改为Print“口令输入错误”&Str(n)&“次”D.把Dim n改为Static n
请补充main函数,该函数的功能是:从键盘输入一组字符串,以‘*’结束输入,并显示出这个字符串。例如,输入abcdefghi*,结果显示adcdefghi。注意:部分源程序给出如下.请勿改动主函数main和其他函数中的任何内容,仅在 main函数的横线上填入所编写的若干表达式或语句。试题程序:include<stdio. h>define N 80main (){iht i=-l, j=0;char str IN];clrscr ();printf("\n Input a string \n");do{i++;scanf(【 】);}while(【 】);printf ("\n**display the string** \n");while (j<i){printf (【 】);j++;}}
下列Application程序输入一个整数,求出它的所有因子,请根据注释,将程序补充完整。public class test19_2 {public static void main(String args[])throws IOException {int n;//下面7行语句的作用是从键盘输入n的值InputStreamReader ir;BufferedReader in;ir=new lnputStreamReader(System.in);in=new BufferedReader(ir);System.out.println("Input n is:");String s=in.______;//读取1行字符n=Integer.parseInt(s);//下面求n的所有因子______(int i=1;i=n;i++) {if(n%i!=0)______;//跳过打印语句回到循环起始System.out.print(i+””);}System.out.print(“\n”);}
下列程序的执行结果为 Private Sub Command1_Click Dim FirStr As String FirSt="abcdef" Print Pat(FirStr. End Sub Private Function Pat(xStr As String.As String Dim tempStr As String, strLen As Integer tempStr="" strLen=Len(xStr. i=1 Do While i=Len(xStr.-3 tempStr=tempStr+Mid(xStr, i, 1)+Mid(xStr, strLen -i+1, 1) i=i+1 Loop Pat=tempStr End FunctionA.abcdefB.afbecdC.fedcbaD.defabc
阅读下面的程序: Private Sub Form_Click() Dim m,n As Integer m=InputBox("请输入M的值") m=Val(m) m1=m n=InputBox("请输入N的值") n=Val(n) n1=n Do While n<>0 remin=m Mod n m=n n=remin Loop Print m1,n1,m End Sub 程序运行后,单击窗体,在对话框中分别输入16和24,则程序在窗体上的输出结果为A.16 24 4B.16 24 8C.24 16 6D.24 16 8
单击命令按钮,并在对话框内输入6,下列程序段的执行结果为______。 Private Sub Command1_Click() Dim n As Integer n=InputBox ("请输入日期") Select Case n Case Is <= 0 n=InputBox("错误!请重新输入日期!") Case Is>7 n=InputBox("错误!请重新输入日期!") Case 1 To 3 Print "江苏" Case 4 To 5 Print "浙江" Case 6 To 7 Print "双休日" End Select End SubA.错误!请重新输入日期!B.江苏C.浙江D.双休日
【程序说明】 程序功能是仅接受输入Y和N的程序,否则程序结束。【程序】DO WHILE .T.WAIT“请输入Y/N” TO ASIF UPPER(AS)<>“Y”AND UPPER(AS)<>“N”(6)ELSE(7)ENDIFENDDO(6)A.EXITB.ENDDOC.LOOPD.CONTINUE
下列程序的执行结果为Private Sub Command1_Click()Dim FirStr As StringFirSt="abcdef"Print Pat(FirStr)End SubPrivate Function Pat(xStr As String) As StringDim tempStr As String,strLen As IntegertempStr=""strLen=Len(xStr)i=1Do While i<=Len(xStr)-3tempStr=tempStr+Mid(xStr,i,1)+Mid(xStr,strLen-i+1,1)i=i+1LoopPat=tempStrEnd FunctionA.abcdefB.afbecdC.fedcbaD.defabc
以下事件过程的功能是:从已存在于磁盘上的顺序文件Num1.txt中读取数据,计算读出数据的平方值,将该数据及其平方值存入新的顺序文件Num2.txt中。则在以下横线处合适的语句是( )。A. Input#1,y Print#2,x,yB. Input#2,x Print #1,x,yC. Print#1,x Input#2,x,yD. Input#1,x Print#2,x,y
有以下程序 main() { int s=0, a=1, n; scanf ( "%d", n); do { s+=l; a=a-2; } while (a! =n); print f ( "%d\n" , s ); 若要使程序的输出值为2,则应该从键盘给n输入不敷出值是A.-1B.-3C.-5D.0
下列给定程序中函数fun()的功能是计算1/n!的值。例如:给n输入5,则输出0.0083330请改正程序中的错误,使它能得到正确结果。注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。试题程序:include <stdio.h>include <conio.h>/******+****found*************/int fun(int n){double result=1.0;if(n==0)return 1.0;while(n>1 n<170)/**********found************/result *=n++;result=1/result;return result;}main(){int n;printf("Input N:");scanf("%d",n);printf("\n1/%d!=%If\n",n,fun(n));}
下列程序的输入值分别为100,10则执行结果为非作歹______ 。 m=Val (inputbox (“请输入数学1”) ) n=Val (inputbox (“请输入数学2”) ) If n*m=0 Then MsgBox “两数能不能为0” Exit Sub If m<n Then t=m: m=n: n=t End If End If DO R=m Mod n m=n n=f Loop While r<>0 Print mA. 10B.100C.50D.250
窗体上有一-个Text1文本框,一个Command1命令按钮,并有以下程序:Private Sub Command1 Click( ) Dim n If Text1.Text"123456"Then n=n+1 Print"口令输入错误”&n&”次" End If End Sub希望程序运行时得到左图所示的效果,即:输入口令,单击“确定口令’’命令按钮,若输入的口令不是“123456”,则在窗体上显示输入错误口令的次数。但上面的程序实际显示的是右图所示的效果,程序需要修改。下面修改方案中正确的是( )。A.在Dim n语句的下面添加一句:n=0B.把Print“口令输入错误”&n&“次”改为Print“口令输入错误”+n+“次”C.把Print“口令输入错误”&n&“次”改为Print“口令输入错误”&Str(n)&“次”D.把Dim n改为Static n
单击命令按钮时,下列程序代码的执行结果为______。 Private Function PickMid(xStr As String) As String Dim tempStr As String Dim strLen As Integer tempStr=“” strLen=Len(xStr) i=1 Do While i<=strLen/2 tempStr=tempStr+Mid(xStr,i,1)+Hid(xStr,strLen-i+1,1) i=i + 1 Loop PickMid=tempStr End Function Private Sub Command1_Click() Dim FirstStr As String FirstStr=“abcdef” Print PickMid(FirstStr) End SubA.abcdefB.afbecdC.fedcbaD.defabc
单击窗体时,下列程序的执行结果是 Private Sub Invert(By Val xstr As String,ystr As String) Dim tempstr AS String Dim I AS Integer I=Len(xstr) Do While I>=1 tempstr=tempstr + Mid(xstr,I,1) I=I - 1 Loop ystr=tempStr End Sub Private Sub Form_Click( ) Dim s1 As String,s2 As String S1="abcdef" Invert S1,S2 Print S2 End SubA.abcdefB.afbecdC.fedcbaD.defabc
执行以下程序段,如果在对话框中输入8,输出结果是"Hello"的是______。A.n = InputBox("请输入一个数") Select Case n Case 7 To 1 Print "Hello" End SelectB.n = InputBox("请输入一个数") Select Case n Case Is>1, Is < 6 Print "Hello" End SelectC.n = InputBox("请输入一个数") Select Case n Case Is > 5, 1, 3 To 10 Print "Hello" End SelectD.n=InputBox("请输入一个数") Select Case n Case 1, 5, Is > 9 Print "Hello" End Select
下列程序的执行结果为Private Sub Command1_Click()Dim FirStr As StringFirSt="abcdef"Print Pat(FirStr)End SubPrivate Function Pat(xStr As String) As StringDim tempStr As String, strLen As IntegertempStr=""strLen=Len(xStr)i=1Do While i=Len(xStr) -3tempStr=tempStr+Mid(xStr, i, 1)+Mid(xStr, strLen -i+1, 1)i=i+1LoopPat=tempStrEnd FunctionA.abcdefB.afbecdC.fedcbaD.defabc
执行如下程序SET TALK OFFS=0I=1INPUT "N=" TO NDO WHILE S 执行如下程序SET TALK OFFS=0I=1INPUT "N=" TO NDO WHILE SS=S+II=I+1ENDDO?SSET TALK ON如果输入值为5,则最后S的显示值是( )。A.1B.3C.5D.6
下列程序的执行结果为 Private Sub Command1_Click() Dim FirStr As String FtrSt="abcdef" Print Pat(FirStr) End Sub Private Function Pat(xStr As String)As String Dim tempStr As String,strLen As Integer tempStr="" strLen=Len(xStr) i=1 Do While i<=Len(xStr)-3 tempStr=tempStr+Mid(xStr,i,1)+Mid(xStr,strLen -i+1,1) i=i+1 Loop Pat=tempStr End FunctionA.abcdefB.afbecdC.fedcbaD.defabc
下列程序的执行结果为 Private Sub Command1_C1ick( ) Dim sl As String,s2 AS String s1="abcdef" Call lnvert(s1,s2) Print s2 End Sub Private Sub lnvert(ByVal xstr As String,ystr As String) Dim tempstr As Stdng i=Len(xstr) Do While i>=1 tempstr=tempstr+Mid(xstr,i,1) i=i-1 Loop ystr=tempstr End SubA.fedcbaB.abcdefC.afbecdD.defabc
下列程序的执行结果为 Ptivate Sub Commandl_Click() Dim FirStr As String FirStr="abcdef" Print Pct (FirStr) End Sub Private Function Pct(xStr As String)As String Dim tempStr As String,strLen As Integer tempStr="" strLen=Len(xStr) i=1 Do While i<=Len(xStr)-3 tempStr=tempStr + Mid(xStr,i,l) + Mid(xStr,strLen - i+i ,1) i=i + 1 Loop Pct=tempStr End FunCtionA.abcdefB.afbecdC.fedcbaD.defabc
下列程序的执行结果为 Private Sub Commandl_Click() Dim s1 As String ,s2 As String s1= "abcd" Call Transfer(sl,s2) Print s2 End Sub Private Sub Transfer (ByVal xstr As String,ystr As String) Dim tempstr As String ystr=tempstr End SubA.dcbaB.abdcC.abcdD.dabc
(34)为了从当前文件夹中读入文件File l .txt,某人编写了下面的程序:Private Sub Command 1_CLick()Open"File l .txt" For Output As #20Do While Not EOF(20)Line Input #20, ch$Print chLoopClose #20End Sub程序调试时,发现有错误,下面的修改方案中正确的是A)在Open语句中的文件名前添加路径B)把程序中各处的"20"改为"1"C)把Print ch语句改为Print #20, chD )把Open语句中的Output改为Input