COP3503Group3-4 / Calculator-Project

Calculator Project
0 stars 0 forks source link

Implement Value toString #4

Closed corya14 closed 10 years ago

corya14 commented 10 years ago

Hayden, can you go into Value, create a virtual method just like printInfo that returns a string called toString, and then implement it for each value.

Ex: RationalNumber's toString would just return "number" where number is the internal number

Fraction's toString would return "(numerator/denominator)"

Log's would return "log_base:num"

etc..

corya14 commented 10 years ago

Damian said you could literally just take the stuff being printed out in the printInfo functions and just convert it to a string.

Inscribed commented 10 years ago

Sure man, I'm in the middle of this good life essay, but once I finish I'll get to work on that.

On Sunday, April 13, 2014, corya14 notifications@github.com wrote:

Damian said you could literally just take the stuff being printed out in the printInfo functions and just convert it to a string.

— Reply to this email directly or view it on GitHubhttps://github.com/COP3503Group3-4/Calculator-Project/issues/4#issuecomment-40318221 .

damianlarson commented 10 years ago

string Log::toString(){ ostringstream logString; logString<<"log_"<printInfo()<<":"<printInfo(); return logString.str(); }

This is the example I have for Log. Every value has a printInfo method, ostringstream, just concatenates everything. If this doesn't work, just make a string that is equal to (in this example, logString).str() and then return that string. You need to include in order to use the ostringstream and obviously include .

damianlarson commented 10 years ago

Alright Hayden, I dun fucked up. My printInfo methods return void, so I need to change them to return a string...fuck.