● C++ is used with proper (73) design techniques. (73)A. object-oriented B. object-based C
● C++ is used with proper (73) design techniques.
(73)
A. object-oriented
B. object-based
C. face to object
D. face to target
● C++ is used with proper (73) design techniques.
(73)
A. object-oriented
B. object-based
C. face to object
D. face to target
C++ is used with proper(73)design techniques.
A.object-oriented
B.object-based
C.face to object
D.face to target
C++ is used with proper(71)design techniques.
A.object-oriented
B.object-based
C.face to object
D.face to target
C++ is used with proper(66) design techniques.
A.class-oriented
B.object-based
C.face to object
D.object-oriented
阅读以下应用说明、图和C++程序,将C++程序中(1)~(6)空缺处的语句填写完整。
【说明】
以下【C++程序】用于实现两个多项式的乘积运算。多项式的每一项由类Item描述,而多项式由类List描述。类List的成员函数主要有:
createList():创建按指数降序链接的多项式链表,以表示多项式:
reverseList():将多项式链表的表元链接顺序颠倒:
multiplyList(ListL1,ListL2)计算多项式L1和多项式L2的乘积多项式。
【C++程序】
include <iostream.h>
class List;
class Item {
friend class List;
private:
double quot ;
int exp ;
Item *next;
Public:
Item(double_quot,int_exp)
{ (1) ;}
};
class List{
private:
Item *list;
Public:
List(){
list=NULL:
}
void reverseList();
void multiplyList(List L1,List L2);
void createList();
};
void List::createList()
{ Item *p,*U,*pre;
int exp;
double quot;
list = NULL;
while (1) {
cout << "输入多项式中的一项(系数、指数) :" << endl;
cin >> quot >> exp:
if (exp<0 )
break ; //指数小于零,结束输入
if (quot=0 )
continue;
p = list;
while ((2) ) { //查找插入点
pre = p;
p = p->next;
}
if (p != NULL && exp = p->exp ) {
p->quot += quot;
continue ;
}
u =(3);
if (p == list)
list = u;
else
pre->next = u;
u ->next = p;
}
}
void List::reverseList()
{ Item *p, *u;
if (list==NULL )
return;
p = list ->next;
list -> next = NULL;
while (p != NULL) {
u = p -> next;
p ->next = list;
list = p;
p = u;
}
}
void List::multiplyList (List L1, List L2 )
{ Item *pL1,*pL2,*u;
int k, maxExp;
double quot;
maxExp =(4):
L2.reverseList();
list=NULL;
for (k = maxExp;k >= 0;k-- ){
pL1 = L1.list;
while (pL1 != NULL && pL1 -> exp > k )
pL1 = pL1 ->next;
pL2 = L2.1ist;
while (pL2 NULL &&(5))
pL2 = pL2 -> next;
quot = 0.0;
while (pL1 != NULL && pL2 != NULL){
if(pL1->exp+pL2->exp==k) {
(6)
pL1 = pL1 -> next;
pL2 = pL2 -> next;
} else if (pL1 -> exp + pL2 -> exp > k )
pL1 = pL1 -> next;
else
pL2 = pL2 -> next;
}
if (quot !=0.0 ) {
u = new item(quot, k );
u -> next = list;
list = u;
}
}
reverseList ();
L2. reverseList ():
}
void main()
{ List L1,L2,L;
阅读以下说明和C++程序,将应填入(n)处的字句写在对应栏内。
[说明]
下面程序实现十进制向其它进制的转换。
[C++程序]
include"ioStream.h"
include"math.h"
include
typedef struct node {
int data;
node*next;
}Node;
Class Transform.
{
DUDlic:
void Trans(int d,int i); //d为数字;i为进制
void print();
private:
Node*top;
};
void Transform.:Trans(int d,int i)
{
int m,n=0;
Node*P;
while(d>0)
{
(1);
d=d/i;
p=new Node;
if(!n){
p->data=m;
(2);
(3);
n++;
}
else{
p->data=m;
(4);
(5);
}
}
}
void Transform.:print()
{
Node*P;
while(top!=NULL)
{
p=top;
if(p->data>9)
cout<<data+55;
else
cout<<data;
top=p->next;
delete p;
}
}
下而程序实现十进制向其他进制的转换。
[C++程序]
include"ioStream.h"
include"math.h"
include <conio.h>
typedef struct node{
int data;
node *next;
}Node;
class Transform
{
public:
void Trans(int d,int i); //d为数字;i为进制
void print();
private:
Node *top;
};
void Transform.:Trans(int d,int i)
{
int m,n=0;
Node *P;
while(d>0)
{
(1) ;
d=d/i;
p=new Node;
if(!n){
P->data=m;
(2) j
(3) ;
n++;
}
else{
p->data=m;
(4) ;
(5) ;
}
}
}
void Transform.:print()
{
Node *P;
while(top!=NULL)
{
p=top;
if(P->data>9)
cout<<data+55:
else
cout<<data;
top=p->next;
delete P;
}
}
A. show ztp neighbor
B.show lldp neighbor
C.show interface
D.show interface neighbor
阅读以下说明和C++程序,将应填入(n)处的字句写在对应栏内。
[说明]
本程序中预设了若干个用户名和口令。用户输入正确的用户名后,可以查找对应的口令,一旦输入结束标记“end”,程序结束。
[C++程序]
include <iostream. h>
include <string. h>
class User
{ protected:
char user[10];
char pass[7];
public:
User(char[ ],char[]);
(1) {return user;}
(2) {return pass;}
};
User::User(char u[],char p[])
{ strcpy(user,u);
strcpy(pass,p); }
void main()
{ User ua[]={User("Li","123456"),User("wang","654321"),User("Song","666666")
char name[10];
while(1)
cout< < "输入用户名:";
cin> >name;
if((3)= =0) break;
for(int i=0;i<3;i+ +)
if(strcmp(name,ua[i].getuser()) = =0){
cout< <"密码:" < < ua[i].getpass() < <endl;
(4);
if((5))cout< <"该用户不存在!" < <endl;
}
}
阅读以下说明和C++程序,将应填入(n)处的字句写在答题纸的对应栏内。
【说明】
本程序用于评选优秀教师和学生。当输入一系列教师或学生的记录后,将优秀学生及教师的姓名列出来。其类结构如下图所示:
【程序】
include <iostream.h>
include <stdio. h>
class base
{
protected:
char name[8];
public:
void getname(){cout<<"name:"; cin>>name;}
void printname(){cout<<"name:"<<name<<endl;}
(1)
};
class student: (2)
{
int num;
public:
void getnum()
{cout<<"score:"; cin>>num;}
bool isgood()
{return (3) }
};
class teacher: (2)
{
int num;
public:
void getnum()
{cout<<"paper:"; cin>>num;}
bool isgood()
{return (num>3)?true:false;}
void main()
{
base *p[50];
student *pstud;
teacher *ptech;
char ch;
int count=0;
do{
cout<<"input teacher(t) or student(s):";
cin>>ch;
if(ch=='s')
{
pstud=new student;
pstud->getname();
pstud->getnum();
p[count++]=pstud;
}
else if(ch=='t')
{
(4)
ptech->getname();
ptech->getnum();
p[count++]=ptech;
}
else
cout<<"input is wrong"<<endl;
cout<<"continue to iput(y/n)?";
cin>>ch;
}while(ch=='y');
for(int i=0;i<count;i++)
if((5))
p[i]->printname();
}
阅读以下说明和C++程序,将应填入(n)处的字句写在对应栏内。
【说明】
设计一个评选优秀教师和学生的程序,其类结构如图6所示。当输入一系列教师或学生的记录后,将优秀学生及教师的姓名列出来。
【程序】
include<iostream.h>
include<stdio.h>
enum boolean {False,True}
class base
{
protected:
char name[8];
public:
void getname() {cout<<"姓名:" ;cin>>name; }
void printname() {cout<<"姓名:"<<name<<endU3
virtual boolean isgood() =0;
}
class student:(1)
{
int num;
public:
void getnum()
cout<<"考试成绩:" cin>>num;
boolean isgood() {return (2);{
};
class teacher:(3) public base
int num;
public:
void getnum()
cout<<"每年发表论文数:" ;cin>>num;
boolean isgood() {return (4);}
};
void main()
base* p[50];
student * pstud;
teacher * ptech;
char ch;
int count =0;
do
cout<<"输入教师(t)或学生(s):"
cin>>ch;
if(ch =='s')
{
pstud = new student;
pstud ->getname();
pstud ->getnum();
p[count ++ ] = pstud;
}
else if(ch == 't')
{
ptech = newteacher;
ptech - >getname()
ptech ->getnum();
p[count++]=ptech;
}
else
cout<<"输入错误<<endl;
cout<<"继续输入码(Y/n)";
cin>>ch;
} while(ch == 'y')
for(int i=0;i<count;i++)
{
if((5)) //若为优秀,则输出
p[i]->printname();
}
}