POJ C + + Programming programming jobs-file operations and templates

Source: Internet
Author: User
Tags setf

Programming Question #: Output format for real numbers

Source: POJ (Coursera statement: The exercises completed on POJ will not count against the final results of Coursera. )

Note: Total time limit: 1000ms memory limit: 1000kB

Describe

The flow manipulation operator is used to implement: Enter a real number, the non-scientific counting method to output, after the decimal point to retain 5 valid digits, and then the scientific counter output, the decimal point retains 7 valid digits.

Note: The output formats on different systems and compilers are slightly different, but it is guaranteed that the default format settings in the program will result in the correct results on the OJ platform.

Input

A positive real number represented by a non-scientific notation, guaranteed to be stored with a double type.

Output

The first line: the non-scientific counting method to output the real number, after the decimal point retains 5 valid digits;

The second line: outputs the real number in scientific notation and retains 7 digits after the decimal point.

Sample input
12.34
Sample output
12.340001.2340000e+01
1#include <iostream>2 using namespacestd;3 intMain () {4     DoubleN;5CIN >>N;6COUT.SETF (iOS::fixed);7Cout.precision (5);8cout << N <<Endl;9COUT.UNSETF (iOS::fixed);Ten COUT.SETF (ios::scientific); OneCout.precision (7); Acout << N <<Endl; -     return 0; -}

POJ C + + Programming programming jobs-file operations and templates

Related Article

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.