⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lt05.cpp

📁 一、教学目的: 能理解C++中运算符重载的需要性
💻 CPP
字号:
#include<iostream.h>
void fn(float interest,float amount)
{
	cout<<"RMB amount=";
	cout.precision(2);//置有效位数为2位
    cout<<amount;
	cout<<"\nthe interest=";
	cout.precision(4);//置有效位数为4位
	cout<<interest<<endl;
}
void main()
{
	float f1=29.41560067;
	float f2=12.567188;
	fn(f1,f2);
}
/*precision()为cout 对象的成员函数,在要求输出一定精度的数据之前,先调用
这个精度设置为成员函数*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -