What are manipulators? Write a cout statement using manipulator to print a float number right justified in the width of 10 columns with precision of 2 digits.
Manipulators are helping functions that can modify the input or the output stream.
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
cout<<"*"<<setw(10)<<setprecision(2)<<2.5782<<"*";
}
Comments
Leave a comment