#include <iostream.h>
#include <stdio.h>
const float UNIT_COST = 12.0;
const int DECIMAL_PLACES_OUTPUT = 2;void main()
{
float Length;
float Width;
float Area;
float Cost; cout << "Please enter length of room: ";
cin >> Length;
cout << endl;
cout << " Please enter width of room: ";
cin >> Width;
cout << endl; Area=Length * Width;
Cost=UNIT_COST * Area;cout << fixed << showpoint //问题应该就是这里两句,望指导~ 谢了
<< setprecision(DECIMAL_PLACES_OUTPUT); cout << "Total Cost is "<< Cost; getchar();
}
#include <stdio.h>
const float UNIT_COST = 12.0;
const int DECIMAL_PLACES_OUTPUT = 2;void main()
{
float Length;
float Width;
float Area;
float Cost; cout << "Please enter length of room: ";
cin >> Length;
cout << endl;
cout << " Please enter width of room: ";
cin >> Width;
cout << endl; Area=Length * Width;
Cost=UNIT_COST * Area;cout << fixed << showpoint //问题应该就是这里两句,望指导~ 谢了
<< setprecision(DECIMAL_PLACES_OUTPUT); cout << "Total Cost is "<< Cost; getchar();
}
解决方案 »
- 视频文件如wmv怎么截取它的缩略图进行显示.就像windows explor看到的缩略图一样.
- vc2005为什么没有了MFC程序的界面设计器
- 请问有几个问题~只需要大家提供一些思路和方法~~
- 用CRecordset::Delete()删除记录时告诉我记录集只读,请问怎么才能把它改成不是只读的
- installshield安装的问题
- 进来有分:请问在选购显示器时,应注意的方面?
- VC与VB混合编程
- vc如何得到用户地址簿中所有的信箱地址???
- MFC分拆窗口之间的函数传递
- 大家新年好!我是新手 在VC++中API编写的程序可以编译并且执行,可是就是无法显示出来。
- 怎么读取注册表中文件夹的名称,而不是值.
- 接口的作用是什么?
<< setprecision(DECIMAL_PLACES_OUTPUT);
这句有什么用?
fixed和showpoint都没有定义啊
<< setprecision(DECIMAL_PLACES_OUTPUT);
你的fixed,showpoint都没声明啊
setprtcision这句呢? 怎样改》
另外setprtcision这个函数呢?
#include <stdio.h>const float UNIT_COST = 12.0;
const int DECIMAL_PLACES_OUTPUT = 2;void main()
{
float Length;
float Width;
float Area;
float Cost; cout << "Please enter length of room: ";
cin >> Length;
cout << endl;
cout << " Please enter width of room: ";
cin >> Width;
cout << endl; Area=Length * Width;
Cost=UNIT_COST * Area; cout << ios::fixed << ios::showpoint //问题应该就是这里两句,望指导~ 谢了
<< setprecision(DECIMAL_PLACES_OUTPUT); cout << "Total Cost is "<< Cost; getchar();
}
#include <iostream>
#include <stdio.h>
#include <iomanip>
using namespace std;
const float UNIT_COST = 12.0;
const int DECIMAL_PLACES_OUTPUT = 2;void main()
{
float Length;
float Width;
float Area;
float Cost; cout << "Please enter length of room: ";
cin >> Length;
cout << endl;
cout << " Please enter width of room: ";
cin >> Width;
cout << endl; Area=Length * Width;
Cost=UNIT_COST * Area; cout << ios::fixed << ios::showpoint //问题应该就是这里两句,望指导~ 谢了
<< setprecision(DECIMAL_PLACES_OUTPUT); cout << "Total Cost is "<< Cost; getchar();
}
#include <iostream>
#include <stdio.h>
#include <iomanip>如果不使用标准名字空间using namespace std则必须要加ios::,相应的头文件为
#include <iostream.h>
#include <stdio.h>
#include <iomanip.h>