I started writing a c++ program but am at a loss! Any Help would be highly appreciated! My program asks for this:
implement a class that models a tally counter, a mechanical device that is used to count people. whenever the operator pushes a button, the counter value advances by one. Model this operation with a count member function. a physical counter has a display to show the current value. in your class, use a get_value member function instead.
I dont need to have (int a, a++) for adding one to the value every time? Im confused with the use a get_value member function instead. Also the class should have a default construct and a constructor to initialize the count. it should also have a set_value () function that sets the value to the integer passed to it. How do I put this in my program?
My Program looks like this but I dont understand why it isnt compiling and what the errors are.
using namespace std;
void set_value(int x)
a = x;
a = 0;
a = c;
int class TallyCounter()
//my errors are as follows:
prog7.cpp:37: error: redefinition of ‘TallyCounter::TallyCounter()’
prog7.cpp:34: error: ‘TallyCounter::TallyCounter()’ previously defined here
prog7.cpp: In function ‘int main()’:
prog7.cpp:42: error: expected primary-expression before ‘int’
prog7.cpp:42: error: expected ‘;’ before ‘int’