Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

question about setw();

brtkltbrtklt Member Posts: 237
I'm trying to figure out the details to setw(). One thing is that if I were to store a string into a string variable and then try to setw() before it it won't happen. I'm sure there's a reason it won't, but is there a work around? For instance:

string myString = "This is my string
";
int i;
i = myString.lenth();
cout << setw(i+10) << myString;

If memory serves, setw() only works w/ integer and string types. Is this correct? I assume it doesn't work w/ string variables, unless I'm doing something wrong.

Comments

  • Justin BibJustin Bib USAMember Posts: 0

    ____ ( http://forcoder.org ) free ebooks and video tutorials about < Assembly, Visual Basic .NET, Python, JavaScript, PL/SQL, C, R, C#, Perl, Ruby, Objective-C, Java, Visual Basic, C++, Scratch, PHP, Swift, Go, Delphi, MATLAB Rust, COBOL, Kotlin, Apex, Lua, Ada, Transact-SQL, Logo, Scheme, Lisp, Crystal, Hack, FoxPro, Prolog, Scala, Julia, Fortran, Erlang, Awk, LabVIEW, F#, SAS, VBScript, ABAP, Bash, D, Clojure, ML, Dart, Alice /> ___________

Sign In or Register to comment.