更多"下面程序的功能是把316表示为两个加数的和,使两个加数分别能被13和1"的相关试题:
[简答题]下面程序的功能是把316表示为两个加数的和,使两个加数分别能被13和11整除,在下画线处应填入的选项是
#include<iostream.h>
Void main( )
int i=0,j,k;
doi++;k=316-13 * i;while(____) ;
j=k/11;
cout < < "316=13 * " < < i < < " +11 *" < < j;
A) k/11 B) k%11 C) k/11=0 D) k%11=0
[单项选择]下面程序的功能是把316表示为两个加数的和,使两个加数分别能被13和11整除,则在横线上应填入的语句是( )。 public class Test { public static void main (String[] args) { int i=0,j,k; do { i++; k=316-13*i; } while(__________); j=k/11; System.out.print("316=13*"+i+"+11*"+j); } }
A. k/11!=0
B. k%11!=0
C. k/11==0
D. k%11==0
[单项选择]下面程序的功能是统计字符串中“array”的个数,在程序的空白处应填入的正确选项是 public class FindKeyWords{ public static void main(String[]args) { String text="An array is a data structur that stores a collection of" +"values of the same type. You access each indMdual value" +"through an integer index. For example,if a is an array" +"of inergers,then a[i]is the ith integer in the array."; int arrayCount=0; int index=-1; String arrayStr="array"; index=text.indexOf(arrayStr); while(index>=0) { ++arrayCount; index+=arrayStr.length( ); index=text.indexOf(arrayStr,index); } System.out.println("the text contains"+arrayCount+"arrays"); } }
A. <
B. =
C. <=
D. >=
[简答题]
阅读以下说明和C++程序,将应填入(n)处的字句写在对应栏内。
【说明】
下面程序的功能是计算并输出某年某月的天数,函数IsLeap Year( )能够判断是否是闰年。
【C++程序】
#
include < iostream >
using namespace std;
(1)
Month {Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec
};
class Date {
public:
Date(
int year, Month m_ month) {
this→year = year;
if(
(2) ) month: Jan;
else month = m_ month;
};
~Date( ){};
bool IsLeap Year( ) {
return ((year%4= =0 &&year% 100 ! =0)||
year%400= =0);
};
int
CaculateDays( ) {
switch(m_month )
{
case (3)
;{
if (4) return 29;
else return 28;
}
case Jan: case Mar: case May: case Jul: case Aug: case Oct: case Dec:
return 31;
case Apr: case Jun: case
Sop: case Nov: return 30;
}
}
private:
int year;
Month month;
};
void
main( ) {
Date day(
[单项选择]下列程序的功能是将一个整数数组写入二进制文件,在程序的下面线处应填入的选项是______。
importjava. io. * ;
public class XieShuzu
public static void main(String[] a)
int[]myArray=(10,20,30,40);
try
DataOutputStream dos=
new DataOutputStream(new
FileOutput Stream("ints. dat"))"
for(int i=0; i<myArray. length; i++)
dos. ______(myArray[i]);
dos. close( );
System. out. println("已经将整数数组写入二进制文件:ints. dat");
catch(IOException ioe)
System. out. println("IO Excepr_on");
A. writeArray
B. writeByte
C. writeInt
D. writeDouble
[单项选择]
下面程序的功能是输出以下形式的金字塔图案是:
*
***
*****
*******在下划线处应填入的是()
main( )
{int i,j;
for(i=1;i<=4;i++)
{for(j=1;j<=4-i;j++) pintf(" ");
for(j=1;j<=________;j++) pintf("*");
printf("/n");
}
}
A. i
B. 2*i-1
C. 2*i+1
D. i+2
[单项选择]下面程序的功能是将从键盘输入的一对数,由小到大排序输出,当输入一对相等数时结
束循环,在划线处应填入的选项是
#include<iostream.h>
voidmain( )
inta,b,t;
cin>>a>>b;
while(______)
if(a>b)
t=a;a=b;b=t;
cout<<a<<""<<b<<endl;
cin>>a>>b;
A. !a=b
B. a!=b
C. a=:b
D. a=b