题目详情
题目详情:
发布时间:2023-12-19 23:06:18

[单项选择]下面程序是计算1+2+3+……+n值,此程序处划线处应填: Dim sum as long,I as integer,n as integer Sum=0 n=val(inputbox(“输入n的值”)) For i=1 to n ______ Next Iprint sum
A. sum=sum+i
B. n=n+i
C. sum=sum+1
D. n=n+1

更多"下面程序是计算1+2+3+……+n值,此程序处划线处应填: "的相关试题:

[简答题]
阅读以下说明和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(
[单项选择]下面程序的功能是统计字符串中“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处的字句写在对应栏内。
【说明】
下面的程序能够计算不同图形的面积。程序中把每个图形的数据定义成结构类型,利用共同体类型描述2种图形的数据。程序根据输入参数代表的图形类型,求出图形的面积并输出。
【程序】
struct Circle
{
float x,y; /*圆心位置*/
float r; /*圆半径*/
};
struct Rectangle
{
float width; /*矩形宽*/
float length; /*矩形长*/
};
union shape
{
struct Circle circle;/*圆数据结构*/
struct Rectangle rectangle;/*矩形数据结构*/
};
main( )
{
union shape a;
float area;
int i;
printf(“input number: 1circle,2rectangle,3 end/n”);
scanf("%d",&i);
while (1) /*循环接收输入,并计算输出*/
{
switch(i)
{
case 1:printf(“input radius:/n”);
scanf(“%f”, (2) ;/*共同体类型变量接收输入*/
area=3.1415926* (3)
printf(“the area of circle=%f/n”,area);
break;
case 2:printf(“input width and length :/n”);
seanf(“%f,%f”, (4) ;/*共
[单项选择]在下面程序中,括号里应填( )。
#include <iostream>
using namespace std;
class A
public:
void fun( )
cout << "Hello" << endl;
;
class B:: public A
void fun( )
( ) //调用基类的函数fun( )
tout << "HI" << endl;

;
A. fun()
B. fun()
C. A::fun()
D. A->fun(
[单项选择]在下面程序的空白处,应填入的正确选项是 import java.io.*; public class ObjectStreamTest {  public static void main(String args[])throws IOExeeption }   ObjectoutputStream oos=new ObjectOutputStream(new FileOutputStream("serial.bin"));   java.util.Date d=new java.util.Date( );   oos. ______(d);   ObjectInputStream ois=new ObjecttInputStream(new FileInputStream("serial.bin"));   try{    java.util.Date restoredDate=(java.util.Date)ois.readObject( );    System.out.println("read object back from serial.bin file:"+restoredDate);   } catch(classNotFoundException cnf) {    System.out.println("class not found");   }  } }
A. WriterObject
B. write
C. BufferedWriter
D. writerObject

我来回答:

购买搜题卡查看答案
[会员特权] 开通VIP, 查看 全部题目答案
[会员特权] 享免全部广告特权
推荐91天
¥36.8
¥80元
31天
¥20.8
¥40元
365天
¥88.8
¥188元
请选择支付方式
  • 微信支付
  • 支付宝支付
点击支付即表示同意并接受了《购买须知》
立即支付 系统将自动为您注册账号
请使用微信扫码支付

订单号:

请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码