题目内容

阅读以下说明和C程序代码,将应填入______处的语句写在答题纸的对应栏内。
[说明]
函数MultibaseOutput(long n,int B)的功能是:将一个无符号十进制整数n转换成 B(2≤B≤16)进制数并输出。该函数先将转换过程中得到的各位数字入栈,转换结束后再把B进制数从栈中输出。有关栈操作的诸函数功能见相应函数中的注释。C代码中的符号常量及栈的类型定义如下:
define MAXSIZE 32
typedef struct{
int * elem; /* 栈的存储区 */
int max; /* 栈的容量,即栈中最多能存放的元素个数 */
int top; /* 栈顶指针 */
}Stack;
[C代码]
int InitStack(Stack * S,int n) / * 创建容量为n的空栈 */
{ S->elem=(int *)malloc(n * sizeof(int));
if(S->elem==NULL)return-1;
S->max=n; (1)=O;return 0;
}
int Push(Stack * S,int item) / * 将整数item压入栈顶 * /
{ if(S->top==S->max){ printf(“Stack is full! \n”);return-1;}
(2)=item;return 0;
}
int StackEmpty(StackS) {return (! S.top)? 1:0;} / * 判断栈是否为空 * /
int Pop(Stack *S ) / * 栈顶元素出栈 * /
{ if(! S->top){printf(“Pop an empty stack! \n”);return-1;}
return (3);
}
void MultibaseOutput(long n,int B)
{ int m;StackS;
if (InitStack(&S,MAXSIZE)){printf(“Failure! \n”);return;}
do {
if(Push(&S, (4) )){printf(“Failure! \n”);return;}
n=(5);
}while(n!=0);
while(! StackEmpty(S)){ / * 输出B进制的数 * /
m=Pop(&S);
if(m<10)printf(“%d”,m); / * 小于10,输出数字 * /
else printf(“%c”,m+55); / * 大于或等于10,输出相应的字符 * /
}
printf(“\n”);
}

查看答案
更多问题

阅读以下应用说明及Visual Basic程序代码,将应真入______处的语句写在答题纸的对应栏内。
[应用说明5.1]
应用程序的窗体中有1个下拉式列表框(名称为Combol)和2个文本框(名称分别为Txt1和Txt2)。运行时,用户从Combo1的列表中进行选择,程序就会将选中条目的内容及编号(从0开始)分别在文本框Txt1和Txt2中显示出来。
[程序代码5.1]
Private Sub Combol_Click()
Txt1,Text=Combol. (1)
Txt2.Text=Combol. (2)
End Sub
(注意:可供(2)处选择的选项有List,Index,ListIndex,LisCount,Number)
[应用说明5.2]
本应用程序的运行窗口如图2-1所示。
当用户在输入框(名为TxtIn)中输入数值数据,并从下拉式列表框(名称为CmbOp)中选择所需的运算后,输出框(名为TxtOut)中就会显示运算的结果。用户单击“清除”按钮(名为CmdClear)后,输入框和输出框都清空。
[程序代码5.2]
Private Sub CmbOp_Click()
Dim DataIn As Double,DataOut as Double
DataIn=(3)
Select Case (4)
Case“取整数部分”
DataOut=Int(DataIn)
Case“求平方根”
If DataIn<0 Then
MsgBox$(“负数不能开平方!”
Else
DataOut=Sqr(DataIn)
End If
Case“取绝对值”
DataOut=Abs(DataIn)
(5)
TxtOut.Text=str$(DataOut)
End Sub

Not all earthquakes are strong enough to cause______.

Scientists have been working hard to warn people of______.

Strawberries: In a study that tracked the diets and health of 1, 271 people in Massachusetts, researchers at the Harvard School of Public Health found that strawberry-lovers were 70 percent less likely than those who rarely ate the fruit to develop cancer.(46).
Tomatoes: With their load of vitamin C, tomatoes are the richest source of the fiery red pigment lycopene, which has been shown to defend against malignancies of the lungs, cervix, prostate, and mouth(47). If they need to ripen, leave them in a cool spot in your kitchen for a day or two.
Oranges: Like all citrus fruits, oranges are known for their aromatic oils and high vitamin C content.(48)
Garlic: Garlic could be your ticket to longevity. The same sulfur compounds that give the bulb its pungent flavour protect against cancer both by neutralizing carcinogens and slowing tumors' growth. If you don't care for garlic, take heart: onions, leeks, shallots, and chives deliver many of the same cancer-fighting substances.
Tea:(49). One recent study found that certain of these compounds appear to keep newly formed tumor cells from growing out of control, a trick they pull off by restoring a chemical in the body that limits how many times the rogue cells can divide.
Whole Wheat:(50). Grain-lovers ran one-third the risk of people who rarely ate whole grain bread or cereal.

A. Loaded with nutrients and fiber, grains have many of the same phytochemicals as fresh produce.
But berries of every kind offer benefits.
C. A lot of people in China like to drink tea because it's traditional.
D. Whatever you do, don't put fresh tomatoes in the fridge unless you want to spoil their flavour and texture.
E. Tea is rich in antioxidants called polyphenols.
F. Citrus-lovers show comparatively low rates of stomach and lung cancers.

答案查题题库