Posted by: nepali8 April 19, 2011
 Login in to Rate this Post:     
0  ?
 
       ?   
 
   
   
 
 ?
 
       ?   
 
   
   
 
#ifndef NUMDAYS_H
#define NUMDAYS_H
#include <iostream>
class NumDays
{
private:
	int hours;
	float day;
public:
	NumDays()
     {
         hours=0;
         day=hours/8.0;
     }
     NumDays(int a)
     {
         hours=a;
         day=hours/8.0;
     }
     void setHours(int);
     int getHour()const{return hours;}
     float getDay()const{return day;}
	 int operator+(NumDays &);
     int operator-(NumDays &);
     int operator++(int);
     int operator++();
     int operator--(int);
     int operator--();
};
#endif
#include <iostream>
#include <cstdlib>
#include "Numdays.h"
using namespace std;
void NumDays::setHours(int a)
{
     hours=a;
}
int NumDays::operator +(NumDays & right)
{
     int totalHours;
     totalHours=hours+right.hours;
     return totalHours;
}
int NumDays::operator -(NumDays & right)
{
     int total_Hours;
     total_Hours=hours-right.hours;
     return total_Hours;
}
int NumDays::operator ++(int)
{
     int Self=hours;
	 hours++;
     day=hours/8.0;
     return Self;
}
int NumDays::operator ++()
{
     hours++;
     day=hours/8.0;
     return hours;
}
int NumDays::operator --(int)
{
     int Self=hours;
     hours--;
     day=hours/8.0;
     return Self;
}
int NumDays::operator --()
{
     hours--;
     day=hours/8.0;
     return hours;
}
i think i am doing right up to here.
This is what so far i got. i need a int main...program to call this function.
thanks for help.
}
i think i am doing right up to here.
This is what so far i got. i need a int main...program to call this function.
thanks for help.
