mohamed azaz wrote:
cout.setf(ios::left); // left justify output text
cout >"This text is left-justified";
cout << "This text is left-justified";
cout.unsetf(ios::left); // return to default (right justified)
this code doesn't work
The problem has nothing to do with the flags. You have used the
extraction operator (>>) when you needed the insertion operator (<<).
The arrows indicate the direction of information flow: During
extraction, a value is moved from the stream to the variable (stream >>
variable). During insertion, a value is moved from the variable to the
stream (stream << variable).