16、如果输入4, -1, 6, 9, 8, 3, 0,请问以下程序的输出结果是() number = int(input('Enter an integer: ')) max = number while number != 0: number = int(input('Enter an integer: ')) if number > max: max = num print(max)

16、如果输入4, -1, 6, 9, 8, 3, 0,请问以下程序的输出结果是() number = int(input('Enter an integer: ')) max = number while number != 0: number = int(input('Enter an integer: ')) if number > max: max = num print(max)


参考答案和解析
ACD

相关考题:

●试题四【说明】下面程序的功能是:在含有10个元素的数组中查找最大数,及最大数所在位置(即下标值),最大数可能不止一个。例如:若输入2857848328则应输出The max:8Total:4∥最大数出现次数The positions:1469【函数】#includestdio.h#define M 10int fun(int*a,int*n,int pos[]){int i,k max=-32767;(1)for(i=0;iM;i++)if( (2) )max=a[i];for(i=0;iM;i++)if( (3) )pos[k++]=i;*n=k;return max;}main(){int a[M],pos[M],i=0,j,n;printf("Enter 10 number:");for(i=0;i<M;i++)scanf("%d", (4) );j=fun( (5) );printf("The max:%d\n",j);printf("Total:%d",n);printf("The position:");for(i=0;i<n;i++)printf("%4d",pos[i]);printf("\n");}

(26)编写下列事件过程和函数过程Private Sub Command1_Click() Dim num(1 TO 6)As Single Num(1)=103:Num(2)=190:Num(3)=0: Num(4)=32:Num(5)=-56:Num(6)=100: Print Print p2(6,num()) End Sub Private Function p2(By Val n Integer,number()As Single)As Integer P2=number(1) For j=2 To n If number(j)p2 Then p2=number(j) Next j End Function 程序运行后,在窗体上输出 A.-56 B.0 C.103 D.190

试题二下面程序中函数fun的功能是:在含有10 个元素的s数组中查找最大数,及最大数所在位置(即,下标值),最大数可能不止一个。最大数作为函数值返回,最大数的个数通过指针变量n传回,所在位置由数组pos传回。例如:若输入 2 8 5 7 8 4 5 3 2 8则应输出:The max: 8Total: 3 //最大数出现次数The positions: 1 4 9请补充下列空缺:includestdio.hincludeconio.hdefine M 10int fun(int *a, int *n, int pos[]){int i, k,max=-32767;(1)for(i=0; iM; i++)if( (2) ) max=a[i];for(i=0; iM; i++)if( (3) )pos[k++]=i;*n=k;return max;}main(){int a[M], pos[M], i=0, j, n;clrscr();printf(Enter 10 number :);for(i=0; iM; i++)scanf(%d, (4));j=fun( (5) );printf(The max: %d\n, j);printf(Total: %d,n);printf(The position:);for(i=0; in; i++ ) printf(%4d, pos[i]);printf(\n);}

有如下程序:includeusing namespace std;class Point{public: static int number; 有如下程序:#include<iostream>using namespace std;class Point{public: static int number;public: Point(){number++;} ~Point(){number--;}};int Point::number=0;void main(){ Point*ptr; Point A,B; { Point*ptr_point=new Point[3]; ptr=pb_point; } Point C cout<<Point::number<<endl; delete[]ptr; }运行时输出的结果是A.3B.4C.6D.7

阅读下列Java程序和程序说明,将应填入(n)处的字句写在对应栏内。【说明】本程序ExceptionTester实现功能:读入两个整数,第1个数除以第2个数,之后输出。若第2个数为0,则自动进行异常处理。程序如下:(1);public class ExceptionTester{public static void main(String args[]){int result;int number[]=new int[2];boolean valid;for(int i=0;i<2;i++){valid=(2);while(!valid){try{System.out.println("Enter number"+(i+1));number[i]=Integer.valueOf(Keyboard.getString()).intValue();valid=true;}catch(NumberFormatExceptione){System.out.println("Invalid integer entered.Please try again.");}}}by{result=number[0]/number[1];System.out.print(number[0]+"/"+number[1]+"="+result);}catch((3)){System.out.println("Second number is 0,cannot do division!");}}}其中,Keyboard类的声明为:impon java.io.*;public class Keyboard{static BufferedReader inputStream=new (4)(new InputStreamReader(System.in));public static int getInteger(){try{return(Integer,valueOf(inputStream.readLlne().trim()).intValue());}catch(Exceptione){e.printStackTrace();return 0;}}public (5) {by{return(inputStream.readLine());} catch(IOExceptione){return "0";}}}

请补充完整程序,使得程序能实现以下功能:从文件IN.dat中读取200个整数至数组number中,求出最大数max及最大数的个数cnt和数组number中能被3整除或能被7整除的算术平均值ave(保留2位小数)。把结果max、 cnt、ave输出到OUT. dat文件中。注意:部分程序、读数据函数read_ dat (int number[200])及输出格式已给出。include <conio. h>include <stdio. h>define N 200void read_ dat(int number[N]){ int i, j;FILE *fp;fp = fopen("IN. dat", "r");for (i=0; i<20; i++){ for (j=0; j<10; j++){ fscanf(fp, "%d,", number[i*10+j]);printf("%d ", number[i*10+j]);}printf ("\n");}fclose (fp);}void main (){ int cnt, number[N], max;float ave;FILE *fw;int i, k; 'long j = 0;fw = fopen("OUT.dat", "w");read_ dat (number);/ ************************************************ // ************************************************ /printf("\n\nmax=%d, cnt=%d, ave=%6.2f\n", max, cnt, ave);fprintf(fw, "%d\n%d\n%6.2f\n", max, cnt, ave);fclose (fw);}

下列程序的输出结果是【 】。 includeclass MyClass{public: int number; void set(in 下列程序的输出结果是【 】。include<iostream. h>class MyClass{public:int number;void set(int i);};int number=3;void MyClass: :set (int i){number=i;}void main( ){MyClass my1;int number=10;my1.set(5),cout<<my1, number<<',';my1.set(number);cout<<my1.number<<',';my1.set(: :number);cout<<my1.number<<'.';}

请补充main函数,该函数的功能是:从键盘输入一组整数,使用条件表达式找出最大的整数。当输入的整数为0时结束。例如,输入1,2,3,5,4,0时,最大的数为5。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在 main函数的横线上填入所编写出的若干表达式或语句。试题程序:include<stdio.h>include<conio.h>define N 100main(){int num[N];int i=-1;int max=0;clrscr();printf("\nInput integer number:\n");do{i++;printf("num[%d]=",i);scanf("%d",【 】);max=【 】num[i]:max;}while (【 】);printf("max=%dkn",max);}

下列程序的输出结果是______。 include template T max(T x[],int n) { int 下列程序的输出结果是______。include<iostream.h>template<class T>T max(T x[],int n){int i;T maxv=x[0];for(i=1;i<n;i++)if(maxv<x[i])maxv=x[i];return maxv;}void main( ){int a[]={3,2,7,6,8,9};double b[]={1.2,3.4,2.5,7.3,6.8};cout<<max(a,4)<<","<<max(b,3)<<endl;}

已知C源程序如下: include include void reverse(char S[]){ int C,i,J; f 已知C源程序如下:include<stdio. h>include<string. h>void reverse(char S[]){int C,i,J;for(i=0,j=strlen(s)-1;i<j;i++,j++){c=s[i];s[i]=s[j];s[j]=c;}}void getHex(int number,char s[]){int I;i=0;while(number>0){if(number%16<10)s[i++]=number%16+'0';elseswitch(number%16){case 10:s[i++]='A';break;case 11:s[i++]='B';break;case 12:s[i++]='C';break;case 13:s[i++]='D';break;case 14:s[i++]='E';break;case 15:s[i++]='F';break;default:printf("Error");break;}number/=16;}s[i]:'\o';reverse(s);}int main(){unsigned int number;int i=0:char s[50];printf("%s","please input number;\n");scanf("%d",&number):getHex(number,s);i=0;while(s[i])printf("%c",s[i++]);return 0;}画出程序中所有函数的控制流程图。

以下程序的运行结果是( ) #define MAX 10 int a[MAX],i; main() { printf("\n");sub1();sub3(A) ,sub2(),sub3(A) ; } sub2() { int a[MAX],i,max; max=5; for(i=0;i<max;i++)a[i]=i; } sub1() {for(i=0;i<MAX;i++)a[i]=i+i; } sub3(int a[]) { int i; for(i=0;i<MAX,i++)printf("%d",a[i]); printf("\n"); }A.0 2 4 6 8 10 12 14 16 18 0 1 2 3 4B.0 1 2 3 4 0 2 4 6 8 10 12 14 16 18C.0 1 2 3 4 5 6 7 8 9 0 1 2 3 4D.0 2 4 6 8 10 12 14 16 18 0 2 4 6 8 10 12 14 16 18

有以下程序: main() { char k: int i; for(i=1:i<3;i++) { scanf("%c",k); switch(k) { case'0':printf("another\n"); case'1':printf("number\n"); } } } 程序运行时,从键盘输入:01<回车>,程序执行后的输出结果是 ______。A.another numberB.another number anotherC.another number numberD.number number

下面程序的执行结果是______。 #define MAX 10 nt a[MAX],i; main() { printf("\n"); sub1();sub3(A) ; sub2();sub3(A) ; } sub1() {for(i=0;i<1MAX;i++) a[i]-i+i; } sub2() {int a[MAX],i,max; max=5; for(i=0;i<max;i++) a[i]=i; } sub3(int a[]) { int i; for(i=0;i<MAX;i++) printf("%d",a[i]); printf("\n"); }A.0 2 4 6 8 10 12 14 16 18 0 1 2 3 4B.0 1 2 3 4 0 2 4 6 8 10 12 14 16 18C.0 1 2 3 4 5 6 7 8 9 0 1 2 3 4D.0 2 4 6 8 10 12 14 16 18 0 2 4 6 8 10 12 14 16 18

阅读以下说明和Java代码,将应填入(n)处的语句写在对应栏内。【说明】进行两个整数之间的比较,由考生通过输入窗口分别输入两个整数,程序比较出结果。例如:先后输入的两个数分别为25和36。比较结果显示:25!=3625<3625<=36【Java代码】import javax.swing.JOptionPane;public class Java3{public static void main(String args[]){String (1) // 用户输入第1个字符串secondNumber, // 用户输入第2个字符串result; // 包含输出int number1, // 比较的第1个数number2; // 比较的第2个数// 用户输入的第1个字符串firstNumber =JOptionPane. (2) ("Enter first integer:");//读用户输入的第2个字符串secondNumber =JOptionPane.showlnputDialog("Enter second integer:");将字符串类型转换成整数类型number1= Integer. (3) (firstNumber);number2= Integer.parselnt(secondNumber);result= "":if ((4))result=number1+"=="+number2;if (number1 != number2)result=number1+"!="+number2;if (number1<number2)result=result+"\n"+number1+"<"+ number2;if (number1>number2)result=result+"\n"+number1+">"+number2;if (number1<=number2)result=result+"\n"+number1+"<="+number2;if (numbed>=number2)result=result+"\n"+number1+">="+number2;//显示结果JOptionPane.(5).(null, result, "Comparison Results",JOptionPane. INFORMATION_MESSAGE);//程序正常退出System.exit(0);}}

阅读以下说明及C++程序代码,将应填入(n)处的语句写在对应栏内。【说明】本程序的功能是实现任意两个大整数的乘法运算,例如:输入整数1:8934793850094505800243958034985058输入整数2:234584950989689084095803583095820923二者之积:209596817742739508050978890737675662366433464256830959194834854876 8534【C++代码】include<iostream.h>const int MAXINPUTBIT=100;const int MAXRESULTBIT=500;class LargeNumber{int i,j;int temp;int one[MAXINPUTBIT+1];int onebit; //one的位数int two[MAXINPUTBIT+1];int twobit; //two的位数int result[MAXRESULTBIT+1];public:LargeNumber();~LargeNumber();int inputone(); //出错返叫0,否则返回1int inputtwo(); //同上void multiplication(); //乘void clearresult(); //清零void showresult(); //显示};LargeNumber∷LargeNumber(){for(i=0;i<=MAXINPUTBIT;i++){one[i]=0;two[i]=0;}nebit=0;twobit=0;inputone();inputtwo();}LargeNumber∷~LargeNumber(){}int LargeNumber∷inputone(){char Number[MAXINPUTBIT+1];cout<<"Please enter one:";cin>>Number;i=0;j=MAXINPUTBIT;while(Number[i]!='\0')i++;nebit=i;for(i--;i>=0;i--,j--){if(int(Number[i])>=48int(Number[i])<=57)(1); //由字符转换为数字elsereturn 0;}return 1;}int LargeNumber∷inputtwo(){char Number[MAXINPUTBIT+1];cout<<"Please enter two:";cin>>Number;i=0;j=MAXINPUTBIT;while(Number[i]!='\0')i++;twobit=i;for(i--;i>=0;i--,j--){if(int(Number[i])>=48int(Number[i])<=57)two[j]=int(Number[i]-48); //由字符转换为数字elsereturn 0;}return 1;}void LargeNumber∷multiplication() //乘法{clearresult();int m;for(i=MAXINPUTBIT;i>=0;i--){temp=two[i];for(j=(2),m=MAXINPUTBIT;m>=0;m--,j--){result[j]+=temp*one[m];if(result[j]>9){result[j-1]+=result[j]/10;(3);}}&n

有以下程序:includeusing namespace std;int f(int x);int sum(int n){ int x,s=0; f 有以下程序: #include<iostream> using namespace std; int f(int x); int sum(int n) { int x,s=0; for(x = 0;x<=n;x++) s+=f(x); return s; } int f(int x) { return (x*x+1); } int main() { int a,b; cout<<"Enter a integer number:"; cin>>a; b=sum(a) ; cout<<a<<","<<b<<end1; return 0; } 如果输入数字3,其输出结果是( )。A.3,12B.3,16C.3,18D.4,20

有如下程序: #inCludeiostream using namespaCe std; Class Point{ publiC: statiC int number; publiC: Point( )t.number++;} ~Point( ){number--;} }; , int P0int::number=0; int main( ){ Point *ptr: Point A,B; Point*ptr_point=new Point[3]; ptr=ptr_point;’ } Point C; CoutPoint:::numberendl; delete[]ptr; return 0; } 执行这个程序的输出结果是( )。A.3B.4C.6D.7

阅读下列Java程序和程序说明,将应填入(n)处的字句写在对应栏内。【说明】本程序实现功能:读入两个整数,第1个数除以第2个数,声明当除数为零时抛出异常类DivideByZeroException。public class DivideByZeroException (1) {public DivideByZeroException ( ) {super("Attcmpted to divide by zero");}}import java.io. *;public class Example {private static int quotient(int numerator, in)\”}t denominator) throwsDivideByZeroException {if (denominator==0)throw (2);return(numerator / denominator);}public static void main(String args[]) {int number1=0, number2=0, result0;try{System.out.print1n("Enter the first number:");number1 = Integer. valueOf(Keyboard.getString()).intValue();System.out.print1n("Enter the second number:");number2 = Integer. Va1ueOf(Keyboard.getString()).intValue();result = quotient(number1,number2);}catch (NumberFormatException e) {System.out.print1n("Invalid integer entered!");System. exit(-1);}catch ((3)) {System.out.print1n(e.to String());System.exit(-1);}Systcm.out.pfint1n(number1 + "/" + number2 + "=" + result);}}其中, Keyboard类的声明为:import java.io.*;public class Keyboard{static BufferedReader inputStream =(4)(new InputStreamReader(System.in));public static int getInteger() {try(return (Intoger.valueOf(inputStream.readLine().trim()).intValue());} catch (Exception e) {e.printStackTrace();return 0;}}public static String getString() {try{return (inputStream.readLine());} catch ((5)){ return "0";}}}

阅读以下说明和C语言函数,将应填入(n)处的字句写在对应栏内。【说明】输入数组,最大的与第一个元素交换,最小的与最后一个元素交换,输出数组。【函数】main ( ){int number[10];input (number);max min (number);output (number);}input (number)int number[10];{int i;for ( i=0;i<9;i++ )scanf ( "%d,",number[i] );scanf ( "%d",number[9] );}max_min ( array )int array[10];{int *max,*min,k,1;int *p,*arr_end;arr end=(1);max=min=array;for ( p=(2);p<arr_end;p++ )if((3)) max=p;else if ( *p<*min ) min=p;(4);l=*min;(5);array[0]=1;1=*p;*p=array[9];array[9]=k;k=*p;return;}output ( array )int array[10];{ int *p;for ( p=array;p<array+9;p++ )printf ( "%d,",*p );printf ( "%d\n",array[9] );}

编写如下事件过程和函数过程: Private Sub Command1_Click() Dim num(1 To 6) As Single num(1)=103: num(2)=190: num(3)=0 hum(4)=32:num(5)=-56: num(6)=100 Print Print p2(6,num()) End Sub Private Function p2(ByVal n As Integer, number() As Single) As Integer p2=number(1) For j=2 To n If number(j)<p2 Then p2=number(j) Next j End Function 程序运行后,在窗体上输出( )。A.-56B.0C.103D.190

编写下列事件过程和函数过程:Private Sub Commandl Click()Dim num(1 To 6)As Singlenum(1)=103:num(2)=190:num(3)=0num(4)=32:num(5)=-56:num(6)=100PrintPrint p2(6,num())End SubPrivate Function p2(ByVal n As Integer,number()As Single)As Integerp2=number(1)For j=2 To nIf number(j)<p2 Then p2=number(j)Next jEnd Function程序运行后,在窗体上输出( )。A.-56B.0C.103D.190

编写如下事件过程和函数过程: Private Sub Command1_Click() Dim num(1 To 6)As Single num(1)=103:num(2)=190:num(3)=0 num(4)=32:num(5)=-56:num(6)=100 Print Print p2(6,num()) End Sub Private Function p2(By Val n As Integer, number() As Single) As Integer p2=number(1) For j=2 To n If number(j)<p2 Then p2=number(j) Next j End Function 程序运行后,在窗体上输出( )。A.-56B.0C.103D.190

以下的语句是正确的。 final int MAX_NUMBER=20; MAX_NUMBER++; 。() 此题为判断题(对,错)。

阅读以下Java代码,填充(1)~(5)的空缺,将解答填入答题纸的对应栏内。 【说明】进行两个整数之间的比较,由考生通过输入窗口分别输入两个整数,程序比较出结果。例如:先后输入的两个数分别为25和36。 比较结果显示: 25!=36 25<36 25<=36 【Java代码】 import javax.swing.JOptionPane; public class Java3 { public static void main(String args[]) { String (1) //用户输入第1个字符串 secondNuimber, //用户输入第2个字符串 result; //包含输出结果的字符串 int number1, //比较的第1个数 number2; //比较的第2个数 //读用户输入的第1个字符串 firstNumber= JOptionPane(2)("Enter first integer:"); //读用户输入的第2个字符串 secondNumber= JOpttionPane.showlnputDialog("Enter second integer:"); //将字符串类型转换成整数类型 number1=Integer.(3)(firstNumber); number2=Integer.parselnt(secondNumber); result=""; if((4)) result=number1+"=="+number2; if(number1!=number2) result=number1+"!=”"+number2; if(number1<number2) result=result+"\n"+number1+"<"+number2; if(numbe1>number2) result=result+"\n"+number1+">"+number2; if(number1<=number2) result=result+"\n"+number1+"<="+number2; if(number1>=number2) result=result+"\n"+number1+">="+number2; //显示结果 JOptionPane.(5)( null,result,"Comparison Results", JOptionPane.INFORMATION_MESSAGE.; //程序正常退出 System.exit(0); }}

下列选项中,属于input元素的number类型属性的是()。A、min属性B、max属性C、list属性D、step属性

单选题1)#include 2)# include 3)using namespace std; 4)double max(double x,doubley); 5)void main() 6){ 7)double a,b,c; 8)cout ab; 10)c=max(a,b); 11)couty) 16)returnx; 17)else 18)returny; 19)}程序第8行执行完后,光标在:()Ainput two number:前面Binput two number:后面Cinput two number:下一行首列D不确定

单选题1)#include 2)#include 3)using namespace std; 4)double max(double x,doubley) 5){ 6)if(xy) 7)return x; 8)else 9)return y; 10)} 11)int main() 12){ 13)doublea,b,c; 14)cout a b; 16)c=max(a,b); 17)cout " the squart of max imum=" sqrt( c ); 18)}执行完第14行后,命令提示符窗口中光标的位置在:()Ainput two number:前面Binput two number:后面Cinput two number:下一行首列D不确定

单选题有如下程序:#include struct pair{ int first,second;};struct pair get_min_max(int*array, int len){ int i; struct pair res; res.first=array[0]; res.second=array[0]; for(i=1;ires.second)   res.second=array[i]; } return res;}main(){ int array[5]={9,1,3,4}; struct pair min_max = get_min_max(array,5); printf(min=%d,max=%d, min_max.first, min_max.second);}程序运行后的输出结果是(  )。Amin=1,max=9Bmin=0,max=9Cmin=1,max=4Dmin=0,max=4