#include#include using namespace std; int main() { int a = 123; double b = 45.678; cout << setw(10) << a << endl; cout << setw(10) << b << endl; return 0; }
#includeIn this example, we have set the width of the output stream to 10, and we have used the std::left and std::right manipulators to align the string, integer, and double values to the left, right, and right, respectively. The package library for the "cpp ostream width" feature is the#include using namespace std; int main() { string name = "John"; int age = 30; double salary = 5000.50; cout << setw(10) << left << name << setw(10) << right << age << setw(10) << right << salary << endl; return 0; }