首页
题库
网课
在线模考
桌面端
登录
搜标题
搜题干
搜选项
0
/ 200字
搜索
问答题
阅读下列算法说明和算法流程,将应填入(n)处的字句写在对应栏内。
【算法说明】
程序实现了常见的猜数字游戏。游戏开始时由程序自动产生一个1到100的随机数,接收用户输入,并给出提示信息,直至用户猜对。用户猜对后,显示猜测次数,并提供“重新开始”和“退出”功能。
算法采用两层循环实现。外层循环采用do-while循环,由循环条件控制是否重新开始。内层采用for循环,用于判断用户的每次输入。m是随机产生的整数,键盘输入是字符串类型变量,n是整型变量。
【问题1】内循环还需要一个变量,其作用为(1)。
【问题2】请将流程图5.2补充完整。
A.2补充完整。
B.shangxueba.cn/images/ct_crppsj_crppsliucheng_00006(20096).jpg'
点击查看答案
在线练习
手机看题
你可能感兴趣的试题
问答题
在考生文件夹下有商品数据库。
(1)在“雇员”窗体中添加“最小化窗体”和“关闭窗体”按钮,编写Ⅶ语句实现最小化窗体和关闭窗体的操作。结果如图所示。
(2)编写VB代码,实现关闭“雇员”窗体时,显示如图所示消息框。
A.shangxueba.cn/images/ct_ctajm_compapp_00123(20092)1.jpg'
B.shangxueba.cn/images/ct_ctajm_compapp_00123(20092)2.jpg'
点击查看答案
手机看题
问答题
阅读以下说明C++代码,将应填入(n)处的字句写在对应栏内。
[说明]
以下程序的功能是实现堆栈的一些基本操作。堆栈类stack共有三个成员函数:empty判断堆栈是否为空;push进行人栈操作;pop进行出栈操作。
[C++程序]
include 'stdafx. h'
include <iostream, h>
eonst int maxsize = 6;
class stack {
float data[ maxsize];
int top;
public:
stuck(void);
~ stack(void);
bool empty(void);
void push(float a);
float pop(void);
};
stack: :stack(void)
{ top =0;
cout < < 'stack initialized.' < < endl;
}
stack:: ~stack(void) {
cout < <' stack destoryed.' < < endl;
bool stack:: empty (void) {
return (1);
void stack: :push(float a)
if(top= =maxsize) {
cout < < 'Stack is full!' < < endl;
return;
data[top] =a;
(2);
}
float stack:: pop (void)
{ if((3)){
cout< < 'Stack is undcrflow !' < < endl;
return 0;
(4);
return (5);
}
void main( )
{ stack s;
coat < < 'now push the data:';
for(inti=l;i< =maxsize;i+ +) {
cout< <i< <' ';
s. push(i);
}
coat < < endl;
cout< < 'now pop the data:';
for(i = 1 ;i < = maxsize ;i + + )
cout< <s. pop()< <' ';
}
A.'
B.'
点击查看答案
手机看题
微信扫码免费搜题