used stream object instead of cout