⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 convert.cpp

📁 数据结构算法 中国水利水电出版社 出版 这本书还不错
💻 CPP
字号:
//十进制数转换成八进制数convert.cpp
#include<iostream.h>
#include<iomanip.h>
#include<malloc.h>
#include<conio.h>
#include<stdlib.h>
#include<stdio.h>
typedef int Status;
typedef int SElemType;
#include "stack.cpp"

void conversion()
{SqStack *S;
 SElemType e;
 int n;
 S->InitStack(&S);
 printf("输入十进制数:");cin>>n;
 if(n<0)
   { printf("\n数必须大于零!\n");
     return;}
 if(!n) S->Push(0);
 while(n){
   S->Push(n%8);n=n/8;}
 printf("结果是:");
 while(!S->StackEmpty()){
   S->Pop(&e);
   printf("%d",e);}
}
void main()
{ printf("convert.cpp运行结果:\n");
  conversion();
  getch();}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -