no function body for input() and output()
>From: "Mitchell, Tamra (DLM)" <Tam...@dl...>
>To: "'dev...@li...'"
><dev...@li...>
>Subject: [Dev-C++] classes
>Date: Wed, 25 Sep 2002 07:25:01 -0400
>
>
>I am a little confused can anyone please help me.
>
>The instructions are: Define a class called Month that is an abstract data
>type for a month. Your class will have one member variable of type int to
>represent a month (1 for Jan 2 for Feb) Include all the following member
>funct. a constructor to set the month using the first three letters in the
>name of the month as 3 arguments, a constructor to set the month using an
>integer as an argument (1 for Jan 2 for Feb) a default constructor an input
>function that reads the as an integer, an input func that reads the month
>as
>
>the first 3 letters in the name of the month, an output func that outputs
>the
>month as an integer and as letters, and a member func that returns the
>next
>
>month as a value of type Month. Embed your class definition in a test
>program.
>
>
>I can not seem to find my error. Here is my code.
>
>
>#include <iostream>
>#include <string.h>
>
>using namespace std;
>class Month
>{
>public:
> void input();
> void output();
> void set(int newMonth);
>
> //void set(int newMonth);
>
> int getMonthNumber();
>private:
> int month;
>};
>int main()
>{
> cout << "Enter the number of the month:\n";
> month.input();
> cout << "The month you entered is : ";
> month.output();
> cout << endl;
> return 0;
>}
>void Month::set(int newMonth)
>{
> if ((newMonth >= 1) && (newMOnth <=12))
> month = newMonth
> else
> {
> cout << "NOT A MONTH!\n"
> exit(1);
> }
>
>Tamra Y. Mitchell
>Database & Operating Systems Analyst
>412-237-5232 - Work
>412-996-9078 - Cell
>
_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx
|