setw
will add the number of spaces to the output stream. If you want to line up colums, you'll need to subract the size of previous stings:
os << rec.lastname << " " << rec.firstname << setw(30 - rec.lastname.size() - rec.firstname.size()) << rec.phonenum;