Hey guys, I'm having a little bit of trouble with a register I'm making. I'm having an error in the build. Also as I'm very new to c++ if you see anything that I can improve on, such as syntax, etc. please tell me as I wish to form good habits. btw, I'm using code blocks if it makes any difference.
Heres head.hpp
Code:
#include <iostream>
class My_reg
{
public:
My_reg(float amount); //enters amount
~My_reg();
void tax(); // declares tax func
void start_up() {sub_total = amount}
float sub_total() {return sub_total} // returns sub_total amount
float get_total() {return sub_total} // return sub after tax
float get_change(float cash); // declares func to get change
private:
float sub_total;
float tax = 0.05 ;
float cash;
float change;
};
main.cpp
Code:
#include "head.hpp"
My_reg::My_reg(float amount)
{
sub_total = amount;
}
My_reg:: ~My_reg()
{
}
My_reg:: tax()
{
sub_total = sub_total + sub_total * tax; //adds tax
}
My_reg:: get_change(float cash)
{
(cash - sub_total)= change;
return change;
}
int main()
{
std::cout << "Please enter the amount:";
std::cin << amount;
My_reg reg(amount);
start_up();
std::cout << "Your sub-total is:" << reg.sub_total();
reg.tax();
std::cout << "/nYour total is:" << reg.get_total();
std::cout << "/n Please enter the amount paid:";
std::cin << cash;
std::cout << "Your change is:" << reg.get_change();
std::cout << "/n/tThank you and have a wonderful day";
return 0;
}
Thank you for any help && || tips. :)
Joe