22 lines
551 B
C++
22 lines
551 B
C++
|
// showpt.cpp -- setting the precision, showing trailing point
|
||
|
#include <iostream>
|
||
|
|
||
|
int main()
|
||
|
{
|
||
|
using std::cout;
|
||
|
using std::ios_base;
|
||
|
|
||
|
float price1 = 20.40;
|
||
|
float price2 = 1.9 + 8.0 / 9.0;
|
||
|
|
||
|
cout.setf(ios_base::showpoint);
|
||
|
cout << "\"Furry Friends\" is $" << price1 << "!\n";
|
||
|
cout << "\"Fiery Fiends\" is $" << price2 << "!\n";
|
||
|
|
||
|
cout.precision(2);
|
||
|
cout << "\"Furry Friends\" is $" << price1 << "!\n";
|
||
|
cout << "\"Fiery Fiends\" is $" << price2 << "!\n";
|
||
|
// std::cin.get();
|
||
|
return 0;
|
||
|
}
|