Practice basic output formatting by reproducing the output below. All floating-point numbers should have 3 decimal places. Use these constants and values: NUM1= 10, NUM2= 1.49, and NUM3= 12.538767
Output:
NUM1 NUM2 NUM3
10 1.490 12.539
------------------------
123456789012345678901234 <-- DO NOT output this area. It is here to help you align things.
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
	int NUM1 = 10;
	float NUM2 = 1.49f;
	float NUM3 = 12.538767f;
	cout << setprecision(3) << fixed;
	cout << "NUM1" << "\tNUM2" << "\tNUM3\n";
	cout << NUM1 << "\t" << NUM2 << "\t" << NUM3 << endl;
	return 0;
}
Comments