newb question: need help with homework assignment

From: don't know (I'mat_at_nowhere.com)
Date: 05/29/04


Date: Sat, 29 May 2004 11:59:54 -0400

Hi,
I have been working on this assignment(with the help of my instructor, she
told me this was ok) and cannot figure out why it doesn't display to the
screen. (She didn't know why either).
Can someone tell me why it doesn't display to the screen? Is it because the
showWork function is in the wrong place?
Thank You,
a frustrated newb

template<class T>
T AddTwo(T x, T y)
{
 T totalMinutes;
    totalMinutes = x + y;
 return (totalMinutes);
}
class Homework
{
private:
 char className[50];
 char assignment[50];
 int minutes;
 int totalMinutes;
public:
 void SetValues(char classNm[], char assign[], int time);
 void showWork();
 Homework operator+(Homework h);
    };
void Homework::SetValues(char classNm[], char assign[], int time)
{
 strcpy(className, classNm);
 strcpy(assignment, assign);
 minutes = time;
}
void Homework::showWork()
{
 cout<<"Homework assignment "<<assignment<<" for "<<className<<" should take
approximately "<<minutes<<endl;
}
Homework Homework::operator +(Homework h)
{
 Homework temp;
 strcpy(temp.className, "Total Homework");
 strcpy(temp.assignment, "Total Assignment");
 temp.minutes = minutes + h.minutes;
 return (temp);
    }

void main()
{
 int a, b, c;
 a = 15;
 b = 25;
 c = AddTwo(a,b);
 double g, h, i;
 g = 5.15;
 h = 4.15;
 i = AddTwo(g,h);
 Homework j, k, l;
 j.SetValues("CS218", "Read Chapter 11", 25);
 k.SetValues("CS310", "Homework: Exercise 12 Page 411", 40);
 l = AddTwo(j,k);
 void showWork();
    getch();
}



Relevant Pages

  • Re: a hint for this
    ... > Sounds like homework, but as lots of people have already given solutions, ... i appreciate your interest, it's not homework, but i'm a newcomer in ... and a self-taught ... ...
    (comp.programming)
  • [PATCH 2/2] display: Driver ks0108 and cfag12864b
    ... Adds support for additional "display" devices, ... +static const unsigned int FirstMinor = 0; ... +void cfag12864b_E(unsigned char _State) ... +void cfag12864b_CS1 ...
    (Linux-Kernel)
  • Re: display array in a frame wnd
    ... Some display are corresponding to several cameras (global ... void CDisplayImg::DrawToHDC ... void CDisplayImg::FillBitmapInfo(BITMAPINFO* bmi, int width, int height, ... int bpp, int origin) ...
    (microsoft.public.vc.mfc)
  • Cone display
    ... display but I cannot get this to work could someone explain to me how ... void display ... void reshape(int w, int h) ... void ExtractCommandLineParameters(int argc, char **argv) ...
    (comp.graphics.api.opengl)
  • Re: polymorph object - why doesnt it work???
    ... virtual void display() const; ... class Node: public Cell { ... void insert(char*, int); ...
    (comp.lang.cpp)