I know some people will say this question is repeated but I really couldn't find a useful answer.
Let's say I have the following program:
#include <iostream>
#include <string>
using std::cout;
int main(){
std::string something;
cout<<"Type something";
std::cin>>something;
}
How can I use setw() so the output will look like this?
Type something "then after some whitespaces for example 10 the user will start typing"
I tried to use setw() in output:
#include <iostream>
#include <string>
#include <iomanip>
using std::cout;
int main(){
std::string something;
cout<<std::left<<std::setw(24)<<"Type something";
std::cin>>something;
}
The expected output was supposed to be:
The actual output is:


One possible solution might be using any special character after
setwSample Code:
Output:
Type something :inputStringReferences:
iomanip setw() function in C++ with Examples
Setw C++: An Ultimate Guide to Setw Function