I have made a game in C++ as part of a project in my high school C++ class and now I'm just messing with it and making it look good.
I have ascii art in it now and i was wondering how i could go about outputting a user-inputed string and then depending on the amount of characters in the string it calculates an even amount of spaces to put before and after it so that it is centered as best as possible inside a field of 46 characters which is mostly spaces but starts and ends with a | .
example |[][][][][][][][][][string][][][][][][][][][]|
[] -empty space
Subtract the length of the string (from now on, len) from 46, then divide the result by 2. That's the number of spaces that should go either before or after. There's a chance 46-len will not be even. Unless len is very close to 46, humans won't be able to tell the difference.
yea so i remember that after you mentioned it only im having an issue my program isnt waiting for the user to input the string even though im using what you have above(of course replaced string variable with my variable name) it allows you to type for a fraction of a second and continues on with the program it only works with a general cin>> but of course then i dont get white space preserved