Code:
#ifndef INCLUDED_DINEOUT_H
#define INCLUDED_DINEOUT_H
class DineOut
{
public:
DineOut(); //void constructor
~DineOut(); //void destructor
int FiftyTimes(int x);
int Twice(int x);
int AddFive(int x);
int HadBirth(int x);
int NotHadBirth(int x);
private:
int x;
};
DineOut::DineOut()
{
int x=1;
}
DineOut::~DineOut()
{
}
int DineOut::FiftyTimes(int x)
{
return x*=50;
}
int DineOut::Twice(int x)
{
return x*=2;
}
int DineOut::AddFive(int x)
{
return x+=5;
}
int DineOut::HadBirth(int x)
{
return x+=1753;
}
int DineOut::NotHadBirth(int x)
{
return x+=1752;
}
#endif
#include <iostream>
#include <cstdlib>
#include "DineOut.h"
int main()
{
using namespace std;
int EatOut;
int YearBorn;
int FinalNumber;
int HaveYouHadBirth;
cout<<"DINING OUT MATHEMATICS."<<endl<<endl;
system("PAUSE");
cout<<endl;
cout<<"\t"<<"Here is some really neat math!"<<endl;
cout<<"\a\v";
cout<<"First, enter the number of times that "<<endl;
cout<<"you would like to dine out a week."<<endl;
cout<<"(This number must be >1 but <10.)"<<flush;
cout<<endl<<endl<<"\t";
cin>>EatOut;
DineOut LetsEat(EatOut);
cout<<endl<<endl;
cout<<"Now, we will multiply this number by 2."<<endl;
cout<<"(Just to be bold!)";
cout<<endl<<endl<<"\t";
cout<<EatOut<<" x 2 = "<<LetsEat.Twice()<<endl<<endl;
system("PAUSE");
cout<<endl<<endl;
cout<<"Now, we will add 5 for Sunday.";
cout<<endl<<endl<<"\t";
cout<<EatOut<<" + 5 = "<<LetsEat.AddFive()<<endl<<endl;
system("PAUSE");
cout<<endl<<endl;
cout<<"Now Multiply it by 50.";
cout<<endl<<endl<<"\t";
cout<<EatOut<<" x 50 = "<<LetsEat.FiftyTimes()<<endl<<endl;
system("PAUSE");
cout<<endl<<endl;
cout<<"Now, if you've had your birthday, please press 1. ";
cout<<endl<<"If you haven't, please press two.";
cout<<endl<<"\t";
cin>>HaveYouHadBirth;
if (HaveYouHadBirth==1)
{
cout<<endl<<endl;
cout<<"Since you've had your birthday, we'll add 1753.";
cout<<endl<<endl<<"\t"<<EatOut<<" + 1753 = "<<LetsEat.HadBirth();
cout<<endl<<endl;
system("PAUSE");
}
else if (HaveYouHadBirth==2)
{
cout<<endl<<endl;
cout<<"Since you haven't had your birthday, we'll add 1752.";
cout<<endl<<endl<<"\t"<<EatOut<<" + 1752 = "<<LetsEat.NotHadBirth();
cout<<endl<<endl;
system("PAUSE");
}
else
{
cout<<"You have not entered a valid number.\a"<<endl<<"\a"<<endl;
system("PAUSE");
cout<<"This program will therefore not work correctly.";
}
cout<<endl<<endl;
cout<<"Now, enter the year you were born.";
cout<<endl<<endl<<"\t";
cin>>YearBorn;
cout<<endl<<endl;
cout<<"Now, we will subtract the year you were born.";
FinalNumber=EatOut - YearBorn;
cout<<endl<<endl<<"\t"<<EatOut<<" - "<<YearBorn<<" = "<<FinalNumber;
cout<<endl<<endl;
system("PAUSE");
cout<<endl<<endl;
cout<<"Finally, you should be left with a three digit number.";
cout<<endl<<endl<<"\t"<<FinalNumber;
cout<<"The first digit is the number of times you would like to"<<endl;
cout<<"dine out a week."<<endl;
cout<<"The last two numbers are:"<<endl<<"duh duh duh duuuuuuuuuhhhhhhh!!!"<<endl;
cout<<"YOUR AGE!!! HAHAHA!!!";
system("PAUSE");
return 0;
}
50 DineOut.h candidates are: int DineOut::NotHadBirth(int)
23 diningoutmath.cpp no matching function for call to `DineOut:ineOut (int &)'
20 DineOut.h candidates are: DineOut:ineOut()
It repeats these comments for different lines throughout the program, why?