May 9, 2011 at 9:51pm UTC
OK, so when can we code??? when can we code???
May 9, 2011 at 9:54pm UTC
@ OP: I know you're excited but these details matter. I'm sorry for sort of highjacking your thread but this is too interesting to just let go of.
@ webJose : I see where you're coming from now, but to me when you say "Compound Unit" like kilometers per hour I think "that's a unit of speed and should be it's own object type".
May 9, 2011 at 9:57pm UTC
OP = Origional Poster, that's you chief.
May 9, 2011 at 10:01pm UTC
Ok, for real here's my idea:
1 2 3 4 5 6 7 8 9 10 11 12
#include <cstdlib>
#include <iostream>
class MeasUnit
{
public :
double Gcf=0 ;
} unit_std ;
typedef int unit_std.Gcf ;
unit_std.Gcf meter=1.0 ;
unit_std.Gcf kilometer=1000.0 ;
//etc.
that should polish up the conversion factors
Last edited on May 9, 2011 at 10:03pm UTC
May 9, 2011 at 10:04pm UTC
You've completely lost me now, does that even compile? I mean even if you add the entry point the datatype 'int' doesn't have a member named "Gcf".
May 9, 2011 at 10:06pm UTC
sorry it should have said
typedef double unit_std.Gcf ;
Last edited on May 9, 2011 at 10:06pm UTC
May 9, 2011 at 10:07pm UTC
I don't really see why not with it double not int...
May 9, 2011 at 10:08pm UTC
You don't use typedef
when you you declare an object of a class...
May 9, 2011 at 10:09pm UTC
Because it makes unit_std.Gcf
a new type. So we define kilometer, meter, etc. as a unit_std.Gcf
type, that's all.
May 9, 2011 at 10:10pm UTC
Why not, there's no differnece just has something.somethinginclass
May 9, 2011 at 10:14pm UTC
So now it would say:
1 2 3 4 5 6 7 8 9 10 11 12 13
#include <cstdlib>
#include <iostream>
class MeasUnit
{
public :
double Gcf=0 ;
} unit_std ;
double GCF=unit_std.Gcf ;
typedef double GCF ;
GCF meter=1.0 ;
GCF kilometer=1000.0 ;
//etc.
Last edited on May 9, 2011 at 10:14pm UTC
May 9, 2011 at 10:15pm UTC
Just do me a favor and try to compile what you've written so far.
May 9, 2011 at 10:16pm UTC
But maybe we should conceal that into a template for organization purposes?
May 9, 2011 at 10:18pm UTC
^You don't seem to understand what a template does.
May 9, 2011 at 10:18pm UTC
Comes up error on line 7 above.
May 9, 2011 at 10:20pm UTC
@ firedraco I think I do.
May 9, 2011 at 10:20pm UTC
Yup, Line 7, 9, 10, 11 and 12. I think you need to slow down for a minute, like firedraco said you seem to be confused about some of these topics.
May 9, 2011 at 10:20pm UTC
So please don't bug me. Thnx.