C++中stack使用的问题
#include<cliext/stack>#include<cliext/vector>#include<stdio.h>typedefcliext::stack<in...
#include <cliext/stack>
#include <cliext/vector>
#include<stdio.h>
typedef cliext::stack<int> Mystack;
void main()
{
int N;
printf("input a decimal number:\n");
scanf_s("%d",&N,5);
Mystack s1;
while(N)
{
s1.push(N%8);
N=N%8;
}
while(!s1.empty())
{
printf("%d",s1.top());
s1.pop();
}
}
//在VS里没使用过stack,请明白人指点下 展开
#include <cliext/vector>
#include<stdio.h>
typedef cliext::stack<int> Mystack;
void main()
{
int N;
printf("input a decimal number:\n");
scanf_s("%d",&N,5);
Mystack s1;
while(N)
{
s1.push(N%8);
N=N%8;
}
while(!s1.empty())
{
printf("%d",s1.top());
s1.pop();
}
}
//在VS里没使用过stack,请明白人指点下 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询