Discussion:
A4Q2 quick question on gcd
(too old to reply)
Cong
2011-07-07 14:59:18 UTC
Permalink
there's a counter for gcd for printing statistics, do we just
implement a private gcd function which takes two Rationalnumbers where
it says "//YOU MAY ADD OTHER PRIVATE MEMBERS"? or did I miss something
obvious?
Cong
2011-07-07 15:28:46 UTC
Permalink
or is it that we define a gcd function that take two ints and is used
for reducing Rationalnumbers?
kevin
2011-07-07 21:33:47 UTC
Permalink
Post by Cong
or is it that we define a gcd function that take two ints and is used
for reducing Rationalnumbers?
I think there is no gcd between two rationalnumbers, so...
Terry Anderson
2011-07-07 22:49:52 UTC
Permalink
You are free to add any private members (where indicated) that you feel
are appropriate, which can include routine members.
--
Terry Anderson
CS 246 Instructor
Post by Cong
there's a counter for gcd for printing statistics, do we just
implement a private gcd function which takes two Rationalnumbers where
it says "//YOU MAY ADD OTHER PRIVATE MEMBERS"? or did I miss something
obvious?
Alex Walter
2011-07-07 23:20:33 UTC
Permalink
Post by Terry Anderson
You are free to add any private members (where indicated) that you feel
are appropriate, which can include routine members.
I'm a bit confused about where and how I need to define extra functions
like gcd. Is it best practice to put it directly in the interface file
with its full definition, just put its prototype in the interface file
and define it externally in the implementation file, or just define it
in the implementation file and not at all in the interface file.

Continue reading on narkive:
Loading...