OJ the number of output in different ways in the brush question

Source: Internet
Author: User

Title Description

Decimal number 1234 is output as decimal

The octal number 1234 is output as octal

Hexadecimal number 1234 by hexadecimal output

Input

No

Output

Decimal number 1234 is output as decimal

The octal number 1234 is output as octal

Hexadecimal number 1234 by hexadecimal output

Sample input
No
Sample output
1234=1234d01234=1234o0x1234=1234h
Tips

Using the output format control Dec Oct hex


Output second line 01234=1234o 1234 ago is the number 0,1234 after the capital letter O

The code is as follows:

#include <iostream> #include <iomanip>using namespace Std;int main () {    int x1=1234;    int x2=01234;    int x3=0x1234;    cout<<x1<< "d=" <<dec<<x1<< "D" <<endl;    cout<< "0" <<oct<<x2<< "o=" <<oct<<x2<< "O" <<endl;    cout<< "0x" <


Operation Result:

OJ the number of output in different ways in the brush question

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.