题目内容

阅读下列说明和算法,回答问题1和问题2。
【说明】
算法5-1用来检查文本文件中的圆括号是否匹配。若文件中存在圆括号没有对应的左括号或者右括号,则给出相应的提示信息,如表5-1所示。
在算法5-1中,stack为一整数栈。算法中各函数的说明如表5-2所示。
【算法5-1】
将栈stack置空,置EOF为false
ch←nextch();
while(not EOF)
k←kind(ch);
ifk== (1) )
push((2) ;push((3) ;
else if(k== (4) )
if(not empty())
pop();pop();
else
显示错误信息(缺少对应左括号或右括号);
显示行号row;显示列号col;
endif
endif
ch←nextch();
endwhile
if(not empty())
显示错误信息(缺少对应左括号或右括号);
while(not empty())
row←pop();col←pop();
显示行号row; 显示列号col;
endwhile
endif
为了识别更多种类的括号,对算法5-1加以改进后得到算法5-2。算法5-2能够识别圆括号、方括号和花括号(不同类型的括号不能互相匹配)。改进后,函数kind(charch)的参数及其对应的返回值如表5-3所示。
【算法5-2】
将栈stack置空, 置EOF为false
ch←nextch();
while(not EOF)
k←kind(ch);
if(k>0)
if(判断条件 1)
push((5) ); push((6) ); push((7) );
else if(判断条件2 and 判断条件3)
pop(); pop(); pop();
else
显示错误信息(缺少对应左括号或右括号);
显示行号row: 显示列号col;
endif
endif
ch←nextch();
endwhile
if(not empty())
显示错误信息(缺少对应左括号或右括号);
while(not empty())
pop(); row←pop(); col←pop();
显示行号row; 显示列号col;
endwhile
endif
请将【算法5-1】和【算法5-2】中(1)至(7)处补充完整。

查看答案
更多问题

论述马克思主义认识论与党的群众路线的关系,这对我国政府当前的”反腐倡廉”有何指导意义?

假如你是ABC公司的财务顾问。该公司正在号虑购买一套新的生产线,估计初始投资为3000万元,预期每年可产生500万元的税前利润(按税法规定生产线应以5年期直线法计提折旧,净残值率为10%,会计政策与此相同),并已用净现值法评价方案可行。然而,董事会对该生产线能否使用5年展开了激烈的争论。董事长认为该生产线只能使用4年,总经理认为能使用5年,还有人说类似生产线使用6年也是常见的。假设所得税税率为33%,资本成本10%,无论何时报废净残值收入均为300万元。 要求: (1)该项目可行的最短使用寿命是多少年(假设使用年限与净现值成线性关系,内插法求解,计算结果保留小数点后两位)? (2)他们的争论是否有意义(是否影响该生产线的购置决策)?为什么?

已知B公司上年的销售收入为60000万元,税前经营利润为3500万元,利息费用为600万元,平均所得税税率为32%,上年年末的金融资产为362万元,金融负债为1578万元,总资产为9800万元,总负债为4800万元。 要求回答下列问题: (1)计算B公司上年的权益净利率(股东权益用年末数计算); (2)如果预计今年的净经营资产净利率提高5个百分点,税后利息率不变,权益净利率提高到49.3%,计算今年的净财务杠杆; (3)如果今年增发新股100万元,权益乘数、总资产周转次数、收益留存率和销售净利率不变,销售增长20%,计算今年的负债增加额和上年的收益留存额; (4)如果今年为了增加负债而发行债券,债券期限为5年,每半年付息一次,面值为1000元,市场利率为6%,发行价格为1050元,计算债券的票面利率。 已知:(P/A,3%,10)=8.5302,(P/F,3%,10)=0.7441。

听材料,回答下列各题: A unique laboratory at the University of Chicago is busy only at night. It is a dream laboratorywhere researchers are at work studying dreamers. Their findings have (26)___________ that everyonedreams from three to seven times a night; although in (27)___________life a person may remember none oronly one of his dreams. What people dream usually (28)___________ !heir waking life experiences, whichare mostly visual in nature. Dream is (29) __ to be a passive event, a (30)___________ that peopleexperience but do not (31) __ control. While the subjects - - usually students___________sleep, specialmachines record their (32) __ waves and eye movementss well as the body movements thatsignal the end of a dream. Surprisingly, all subjects sleep (33) . Observers report that a personusually feels anxious before a dream. Once the dream has started, h is body relaxes and his eyes becomemore active, as if the curtain had gone up on a show. As soon as the machine indicates that the dreamis over, the sleeper is weakened by the researcher. He (34)___________, records his dream, and goes backto sleep___________perhaps to dream some more. Researchers have found that if the dreamer is wakened afterhis dream (35)___________, he can usually recall the entire dream. If he is allowed to sleep even five moreminutes, his memory of the dream will have faded. 第(26)题___________

答案查题题库