Closed. This question is
The actual output is:
CodePudding user response:
I can't reproduce what you say, the code you have showed works fine for me.
#include <iostream>
#include <string>
#include <iomanip>
int main(){
std::string something;
std::cout << std::left << std::setw(24) << "Type something";
std::cin >> something;
return 0;
}
That said, you could simply output a string with the desired number of spaces:
#include <iostream>
#include <string>
int main(){
std::string something;
std::cout << "Type something ";
std::cin >> something;
}
CodePudding user response:
One possible solution might be using any special character after setw
Sample Code:
int main()
{
std::string something;
cout<< "Type something" << setw(24) << ":";
std::cin>>something;
}
Output:
Type something :inputString
References:
iomanip setw() function in C with Examples
Setw C : An Ultimate Guide to Setw Function