Skip to content

Instantly share code, notes, and snippets.

@allisons
Created November 20, 2009 01:41
Show Gist options
  • Save allisons/239206 to your computer and use it in GitHub Desktop.
Save allisons/239206 to your computer and use it in GitHub Desktop.
ostream& operator<<(ostream& out, const stock& s)
{
int dollars = s.sharePrice / 100;
out << setfill(' ') << left << dec
<< setw(8) << s.symbol
<< setw(36) << s.name
<< " " << setw(5) << right << dollars << "."
<< setw(2) << setfill('0') << s.sharePrice - dollars * 100
<< setfill(' ')
<< " " << s.priceDate
<< endl;
out << "--- stock" << endl
<< "symbol: " << s.symbol << endl
<< "name: " << s.name << endl
<< "share price: " << dollars
<< "."
<< setw(2) << setfill('0') << s.sharePrice - dollars * 100 << endl
<< "date: " << s.priceDate << endl;
return out;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment