我不知所措,需要这个项目的帮助。 [英] I am overwhelmed and need help with this project.

查看:80
本文介绍了我不知所措,需要这个项目的帮助。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用语句完成提供的main()程序以完成以下各项操作。在每种情况下,您都必须使用适当的I / O流操纵器来尽可能地生成适当的输出。请参考下面的示例输出作为正确输出对齐的指南。



首先输出一个整数值,然后输出一个空格,然后以书面形式输出。 br />
输出秒作为基数为十的值,后跟一个空格,然后是十六进制值,后跟一个空格,然后是八进制值。确保输出中显示相应的基本指示符前缀。

输出第三。

输出第四个四位数,符号显示在左边,右边的值对齐。小数点也必须出现。

输出第四位有四位有效数字。

输出第五位,有七位有效数字。 (必须左对齐)

输出第五位,小数点右边有三位数。

输出第三位。

输出第四位小数点右边的两位数。

输出第六位,没有小数部分显示

输出第四位,小数点右边有八位数。

六位数输出第六位。



您必须使用以下程序开始编码。您不能修改它,除非在解决方案启动之间添加所需的代码,解决方案结束注释。

Complete the provided main() program with statements to accomplish each of the following. In each case you must use the appropriate I/O stream manipulators to produce the appropriate output wherever possible. Refer to the sample output below as a guide for proper output alignment.

Output first first as an integer value, followed by a space, then in its written form.
Output second as a base ten value, followed by a space, then as a hexadecimal value, followed by a space, then as an octal value. Make sure the appropriate base indicator prefix is shown in the output.
Output third.
Output fourth with four digits, with the sign shown at the left, and the value right aligned. The decimal point must also appear.
Output fourth with four significant figures.
Output fifth with seven significant figures. (Must be left-aligned)
Output fifth with three digits to the right of the decimal point.
Output third.
Output fourth with two digits to the right of the decimal point.
Output sixth with no decimal portion showing
Output fourth with eight digits to the right of the decimal point.
Output sixth with six digits.

You must start your coding by using exactly the following program. You may not modify it, except to add the required code between the Solution starts, and Solution ends comments.

#include <iostream>
#include <iomanip>
using namespace std;
int
main()
{
    bool first;
    int second;
    long third;
    float fourth;
    float fifth;
    double sixth;

    cout << "Enter bool, int, long, float, float, and double values: ";
    cin >> first >> second >> third >> fourth >> fifth >> sixth;
    cout << endl;

// ***** Solution starts here ****

// ***** Solution ends here ****

    cin.get();
    return 0;
}



SAMPLE PROGRAM OUTPUT(假设用户输入值以粗体显示):

输入bool,int,long,float,浮点数和双倍值:

1 69 1464878 6443.39 -7.273 -6443.39

1 true

69 0x45 0105

1464878

+ 6443.

6.4434e + 03

-7.2729998e + 00

-7.273

1464878

6443.39

-6443

6443.39013672

-6443.39

推荐答案

这里有一些文章可以帮助你:

http://arachnoid.com/cpptutor/student3.html [ ^ ]

http:// cplus.about.com/od/learning1/ss/clessontwo.htm [ ^ ]

http://www.umsl.edu/~subramaniana/formatting.html [ ^ ]
Here are some articles that will help you here:
http://arachnoid.com/cpptutor/student3.html[^]
http://cplus.about.com/od/learning1/ss/clessontwo.htm[^]
http://www.umsl.edu/~subramaniana/formatting.html[^]


这篇关于我不知所措,需要这个项目的帮助。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆