- 4
- 0
- 约1.65千字
- 约 41页
- 2023-03-09 发布于上海
- 举报
大整数相加;数制转换的原理为: N = (N div d)×d + N mod d;void conversion ( ) {
// 显示和输入的十进制数对应的八进制数值
InitStack(S);
scanf (%d,N);
while (N) {
Push(S, N % 8);
N = N/8;
}
while (!StackEmpty(S)) {
Pop(S,e);
printf ( %d, e );
}
} // conversion;检验含两种括弧的表达式中括弧匹配的正确性。;[ ;算法的设计思想:;bool matching(char exp[], int n) {
// 检测长度为 n 的字符序列 exp 中的括弧是否匹配
int i = 0; mat = true; InitStack(S);
while ( in mat ) {
switch of exp[i] {
case 左括弧:{ Push(S,exp[i]); i++; break; }
case ? ) ? : {
if ( !StackEmpty(S) GetTop(
原创力文档

文档评论(0)