![]() |
In C++, the outputs produced by the program are by default to the left of the screen. In this article, we will learn how to right justify the output in C++. Example: Input: Right Justifying the Output in C++To right justify the output in C++, we can use the std::right function which is one of the stream manipulators that sets the position of fill characters in conjunction with the std::setw manipulator function, which sets the stream width to the specified number of characters passed as an integral argument to this method. C++ Program to Right Justify the OutputThe below program demonstrates how we can justify the output values on the right side of the console in C++.
Output 123.45 6.7899 34.789 Time Complexity: O(1) |
Reffered: https://www.geeksforgeeks.org
C++ |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 19 |