#P31. 练7.3买图书
练7.3买图书
说明
已知小明有元,他买了一本书,这本书原价为元,现在打折出售。求小明还剩多少钱(保留位小数)。
输入格式
输入,。
输出格式
小明还剩多少钱(保留位小数)。
样例
100 100
20.00
提示——这是一段你可能可以用到的参考代码,肯定不是答案!
#include <iostream>
#include <iomanip> // Header file needed to use setprecision
using namespace std;
int main()
{
double number1 = 132.364, number2 = 26.91;
double quotient = number1 / number2;
cout << quotient << endl;
cout << setprecision(5) << quotient << endl;
cout << setprecision(4) << quotient << endl;
cout << setprecision(3) << quotient << endl;
cout << setprecision(2) << quotient << endl;
cout <<fixed<< setprecision(2) << quotient << endl;
cout << setprecision(1) << quotient << endl;
return 0;
}