数字转换为十六进制数 题解:
#include<bits/stdc++.h>
using namespace std;
int main(){
int s;
while(cin>>s){
if(s==0){
cout<<0;
return 0;
}
string ans; //储存答案
if(s<0) {
unsigned int tmp;
tmp=(unsigned int)(s);
while(tmp!=0){
int w = (tmp%16);
if(w<10) ans+=w+'0';
else ans+=(w-10)+'a...
登录后发布评论
暂无评论,来抢沙发