Function Declaration
I'm getting invalid function declaration for compute. It needs to accept two arguments.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
//tip.h header file
class tipCalc
{
private:
double taxRate;
double cost;
public:
void compute(double, double);
void print();
};
void tipCalc:compute(double c, double t)
{
cost = c;
taxRate = t;
}
void tipCalc::print()
{
std::cout << cost << std::endl;
std::cout << taxRate;
}
//=============================== tip.cpp file.
#include <iostream>
#include "tip.h"
using namespace std;
int main()
{
tipCalc newTip;
double a;
double b;
cout << "Please enter the cost of your dinner: ";
cin >> a;
cout << "Please enter your tax rate in decimal format: ";
cin >> b;
newTip.compute(a, b);
newTip.print();
system("PAUSE");
return 0;
}
|
at line 15, you are missing a colon ( : )
Topic archived. No new replies allowed.