一道简单的C++试题

来源:百度知道 编辑:UC知道 时间:2024/06/14 01:16:24
设有变量定义如下:
int i=8,j=12;
double x=3.14, y=90;
希望得到如下的输出结果:
i=10 j=c
x=3.140000E+000 y=90
请编程实现

#include <iostream>
#include <iomanip>

using namespace std;

int main()
{
int i = 8,j = 12;
double x = 3.14,y = 90;
cout<<"i="<<oct<<i<<endl;
cout<<hex<<"j="<<12<<endl;
cout<<scientific<<uppercase<<"x="<<x<<endl;
cout<<"y="<<dec<<(int)y<<endl;
return 0;
}

实在不明白你在说什么,明白了为什么你的问题没人答