标签:style blog http color os io strong 2014
#include <iostream> using namespace std; #include <stack> #include <algorithm> int main() { int i,k,n,m; stack<int>s; scanf("%d%d",&n,&m); while(n) { s.push(n%m); n=n/m; } while(!(s.empty())) {if(s.top()<10) cout<<s.top(); else cout<<char(‘A‘+s.top()-10); s.pop(); } cout<<endl; }
#include <iostream>
using namespace std;
#include <stack>
#include <algorithm>
int main()
{
int i,k,n,m;
stack<int>s;
scanf("%d%d",&n,&m);
while(n)
{
s.push(n%m);
n=n/m;
}
while(!(s.empty()))
{ if(s.top()<10) cout<<s.top();
else cout<<char(‘A‘+s.top()-10);
s.pop(); }
cout<<endl;
}
标签:style blog http color os io strong 2014
原文地址:http://www.cnblogs.com/2014acm/p/3901446.html