题目详情
当前位置:首页 > 计算机考试 > 初级程序员
题目详情:
发布时间:2024-08-01 06:32:28

[填空题][说明]
下面的程序是通过双链结构来查找学生的信息程序的一部分,即创建双向链表部分。
[函数]
#include <stdio.h>
#define N 10
typedef struct node

char name [20];
struct node *llink,*rlink;
stud; /*双链表的结构定义*/
/*双链表的创建*/
stud * creat (int n)

stud *p,*h,*s;
int i;
if ((h= (stud *) malloc (sizeof (stud))) ==NULL)

printf ("cannot find space! /n") ;
exit (0) ;

h->name[0]=’/0’;
h->llink=NULL;
h->rlink=NULL;
p=h;
for(i=0; i<n; i++)

if((s= (stud *) malloc (sizeof (stud)))==NULL)

printf ("cannot find space! /n") ;
exit (0) ;

(1) ;
printf("Please input the %d man’s name: ";i+1) ;
scanf("%s", s->name) ;
(2) ;
(3) ;
p=s ;

(4) ;
(5) ;
return (h) ;

更多"[说明] 下面的程序是通过双链结构来查找学生的信息程序的一部分,即创"的相关试题:

[填空题][说明]
下面的程序是通过双链结构来查找学生的信息程序的一部分,即创建双向链表部分。
[函数]
#include <stdio.h>
#define N 10
typedef struct node

char name [20];
struct node *llink,*rlink;
stud; /*双链表的结构定义*/
/*双链表的创建*/
stud * creat (int n)

stud *p,*h,*s;
int i;
if ((h= (stud *) malloc (sizeof (stud))) ==NULL)

printf ("cannot find space! /n") ;
exit (0) ;

h->name[0]=’/0’;
h->llink=NULL;
h->rlink=NULL;
p=h;
for(i=0; i<n; i++)

if((s= (stud *) malloc (sizeof (stud)))==NULL)

printf ("cannot find space! /n") ;
exit (0) ;

(1) ;
printf("Please input the %d man’s name: ";i+1) ;
scanf("%s", s->name) ;
(2) ;
(3) ;
p=s ;

(4) ;
(5) ;
return (h) ;

[填空题][说明]
下面程序是为汽车市场编制的一个程序的一部分。其中automobile是基类。
[Java程序]
class MainJava
public static void main (String agr[]
car sedan=new car;
sedan.initialize (24, 20.0, 4);
System.out.println("The sedan can travel"
+ (1) +"miles./n");
System.out .println("The sedan has"
+ (2) +"doors./n");


class automobile
protected int miles_per_gallon; //汽车每加仑行驶公里数
(3) double fuel_capacity; //油箱容积
public void initialize (int in_mpg, int in_fuel)
miles_per_gallon=in_mpg;
fuel_capacity=in_fuel;

public int get_mpg( ) //提供一辆特定汽车每加仑公里数
return miles_per_gallon;

public double get_fuel( ) //提供油箱容积
return fuel_capacity;

public double travel_distance( ) //计算满油箱情况下的可行驶总公里数
return (4) ;


class car (5)
private int Total_doors;
public void initialize(int in_mpg, double in_fuel, int doors)
Total_doors=doors;
miles_p
[单项选择]请阅读下面程序,说明该程序创建线程使用的方法是( )。   public class ThreadTest   {   public static void main(String args[])   {   Thread tl=new Thread(new HolloWorld( ));   Thread t2=new Thread(new HolloWorld( ));   tl.start( );   t2.Start( );   }   }   class HolloWorld implements Runnable   {   int i;   public void run( )   {   while(true)   {   System.out.println("HolloWorld"+i++);   if(i= =5)break;   }   }   }
A. 继承Thread类
B. 实现Runnable接口
C. tl.start()
D. t2.start()
[填空题]阅读以下说明和Java程序,将应填入 (n) 处的字句写在对应栏内。 [说明] 下面程序是为汽车市场编制的一个程序的一部分。其中automobile是基类。 [Java程序] class MainJava{ public static void main(String agr[]){ car sedan=new car( ); sedan.initialize(24,20.0,4); System.out.println ("The sedan can travel" + (1) +"miles./n"); System.out.println ("The sedan has" + (2) +"doors./n"); } } class automobile{ protected int miles_per_gallon; //汽车每加仑行驶公里数 (3) double fuel_capacity; //油箱容积 public void initialize(int in_mpg,int in_fuel){ miles_per_galion=in_mpg; fuel_capacity=in_fuel; } public int get_mpg( ){//提供一辆特定汽车每加仑公里数 return miles_per_gallon; } public double get_fuel( ){//提供油箱容积 return fuel_capacity; } public double travel_distance( ){//计算满油箱情况下的可行驶总公里数 return (4) ; } } class car (5) { private int Total_doors; public void initialize(int in_mpg,double in_fuel,int doors){ Total_doors=doors; miles_per_gallon=in_mpg;
[填空题]阅读以下说明和Java程序,将应填入 (n) 处的字句写在对应栏内。
[说明]
下面程序输出一个矩形面积,以及矩形区域上的假想的作物产量。
[Java程序]
public class MainJava
public static void main(String[] args)
Lot_size small=new Lot_size( );
Lot_size medium=new Lot_size( );
small.set(5,5,5,25);
medium.set(10,10,10,50);
System.out.println("For a small lot of area"
+small.get_area( )+"/n");
System.out.println("the actual crops are $"
+small.get_data2( )+"/n");
System.out.println("and ideal crops are $"
+small.get data( )+"/n");
System.out.println("For a medium lot of area"
+medium.get_area( )+“/n”);
System.out.println("the actual crops are $"
+medium.get_data2( )+"/n");
System.out.println ("and ideal crops are $"
+medium.get_data( )+"/n");
class Crop_assessment
private int actual_crop;
private int ideal_crop;
public void set(int
[填空题]阅读以下说明和C++程序,将应填入 (n) 处的字句写在对应栏内。
[说明]
下面程序输出一个矩形面积,以及矩形区域上的假想的作物产量。
[C++程序]
#include <iostream.h>
class crop_assessment

int actual_crop;
int ideal_crop;
public:
void set(int in_actual,int in_ideal)

actual crop=in_actual;
ideal_crop=in_ideal;

int get_actual_crop(void) (1) ;
int get_ideal_crop(void) (2) ;)
;
Class lot_size

int length;
int width;
(3) crop;
public:
void set(int 1,int w,int a,int i)

length=1;
width=w;
crop.set(a,i);

int get_area(void)return length*width;
int get_data(void)return (4) ;
int get_data2(void)freturn (5) ;

int main( )

Los_size small,medium;
small.set(5,5,5,25);
medium.set(10,10,10,50);
cout<<"For a small lot of area"<<smallget_area( )<<“/n”;
cout<<"the actual
[填空题]阅读以下说明和C++程序,将应填入 (n) 处的字句写在对应栏内。
[说明]
下面程序是为汽车市场编制的一个程序的一部分。其中automobile是基类。
[C++程序]
//Auto.h
#ifndef AUTO_H
#define AUTO_H
class automobile
{
(1):
int miles_per_gallon; //汽车每加仑行驶公里数
float fuel_capacity; //油箱容积
public:
void initialize(int in_mpg,int in_fuel);
int get_mpg(void);
float get_fuel(void);
float travel_distance(void);
}
#endif
//Auto.cpp
#include"auto.h"
void automobile::initialize(int in_mpg,float in fuel)
{
miles_per_gallon=in_mpg;
fuel_capacity=in_fuel;
)
int automobile::get_mpg( ) //提供一辆特定汽车每加仑公里数
{return miles per_gallon;}
float automobile::get_fuel( ) //提供油箱容积
{return fuel_capacity;}
float automobile::travel_distance( )
{return (2) }
//car.h
#ifndef CAR_H
#define CAR_H
#include"auto.h"
class car: (3)
{
int Total_doors;
public:
void initialize(int
[简答题]
阅读下列程序说明和C++程序,把应填入其中(n)处的字句,写对应栏内。
【说明】
下面的程序实现了类String的构造函数、析构函数和赋值函数。
已知类String的原型为:
class String
{
public:
String(coust char * str = NULL); //普通构造函数
String( const String &other); //拷贝构造函数
~String(void); //析构函数
String & operate =(const String &other); //赋值函数
private:
char * m_data; // 用于保存字符串
};
//String 的析构函数
String:: ~String (void)
{
(1) ;
}
//String 的普通构造函数
String: :String( const char * str)
{
if (2)
{
m_data = new char[1];
*m_data = ’/0’;
}
else
{
int length = strlen(str);
m_data = new ehar[ length + 1 ];
strepy(m_data, str);
}
}
//拷贝的构造函数
String:: String( const String &other)
{ int length = strlen(other. m_data);
m_data = new char[ length + 1 ];
strepy(m_data, other, m_data); //赋值函数
String & String::operate = (eonst Stri

我来回答:

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

订单号:

截图扫码使用小程序[完全免费查看答案]
请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码