You need to use std::setw
in conjunction with std::right
.
#include <iostream>
#include <iomanip>
int main(void)
{
std::cout << std::right << std::setw(13) << "foobar" << std::endl;
return 0;
}
More Related Contents:
- g++ crashed when I tried to compile a program with ONE LINE
- Why to use function pointer? [duplicate]
- Is `&variable = null;` possible? [closed]
- I’m having an issue with not converting const__gnu_cxx::__normal_iterator
- What is different between while(aPointer) and a if(aPointer) in C++? [closed]
- Post-increment and Pre-increment concept?
- When to use reinterpret_cast?
- Can someone explain this template code that gives me the size of an array? [duplicate]
- How to correctly implement custom iterators and const_iterators?
- Does the C++ standard mandate poor performance for iostreams, or am I just dealing with a poor implementation?
- Should I prefer pointers or references in member data?
- How to convert C++ Code to C [closed]
- MSVCP140.dll missing
- What is the “–>” operator in C++?
- std::transform() and toupper(), no matching function
- What happens to uninitialized variables? C++
- Error with multiple definitions of function
- How to read cin with whitespace up until a newline character?
- Should I store entire objects, or pointers to objects in containers?
- Will consteval functions allow template parameters dependent on function arguments?
- Why are `&array` and `array` pointing to the same address?
- CRTP — accessing incomplete type members
- What should a C++ getter return
- How to exit a blocking recv() call? [duplicate]
- How to initialize static members in the header
- Why Can’t I store references in a `std::map` in C++?
- What is “->” after function declaration?
- Differences between running an executable with Visual Studio debugger vs without debugger
- Seeking code stub generator (from header files) [closed]
- Is there a case where including the same header twice is actually helpful?