Write a class ‘Counter’ which has a data member currentVal which hold the current value of the counter. Add a constructor which takes the intial value of the counter. Then add increment/decrement functions to this class which increment/decrement the value of the currentVal. Add a printValue function which prints the current value.
Then write a main function which will create a object of the Counter class with 5 as the initial value. Then call increment and decrement functions and print the values after each call.
It’s the most wonderful time of the year! There’ll be much hollying and jollying, but there will also be plenty…
APPROVED BY CLIENTS
The services I have receive were remarkable. Everything was finished before the deadline and superseded my expectations as a first time user. I was honestly really nervous at first but now that I can trust Assignment Expert, I will definitely be utilizing it more and recommending friends as well! YOU ROCK
Comments
Leave a comment