+ 1

Anyone know how to align the cin object so that the input can be taken a little bit right rather than the left border of cnsole?

Example: Can this be done? cout<<"Enter your age"<<endl; cin>>age; Output: Enter your age [...Input] (Display the input with three whitespace) those three dots represent three whitespace before the input Rather than the usual cout<<"Enter your age"<<endl; cin>>age; Output: Enter your age [Input] (Display the input on the left of the console) I've tried with the setw() function that sets the number of print field space with cin but it doesn't seem to work :(

14th Oct 2017, 8:59 AM
Musicalcholic
Musicalcholic - avatar
2 odpowiedzi
+ 2
cout << "Enter your age" << endl << " "; // <-- Did you try adding 3 spaces to your cout? cin >> age;
14th Oct 2017, 9:14 AM
ChaoticDawg
ChaoticDawg - avatar
+ 1
Oow crap should've done that completely forgot about it...that worked thanks a lot :)
14th Oct 2017, 9:23 AM
Musicalcholic
Musicalcholic - avatar