hdu 1720

来源:互联网 发布:网络编辑兼职在哪找 编辑:程序博客网 时间:2024/04/29 18:17
#include <iostream>#include <iomanip> using namespace std;int main(int argc, char *argv[]){   long long a,b;   while(cin>>hex>>a>>b)// hex 表示 16进制输入    {    if(a<0){    a=-a; a+=b;    cout<<setiosflags(ios::uppercase)<<"-" //10进制输出     <<a<<endl;     }         a=a+b;      cout<<setiosflags(ios::uppercase)<<a<<endl;        }return 0;}


ios::showbase是显示进制,ios::uppercase大写显示,所以0X 十六进制大写显示

http://www.cnblogs.com/t427/archive/2012/06/02/2532070.html

原创粉丝点击