A challenge for all you CompSci people

Just a nifty programming challenge for you guys. If you think you figured it out, post it on the comments!

Define a class for a type called CounterType. An object of this type is used
to count things, so it records a count that is a non-negative whole number.

Include a mutator function that sets the counter to a count given as an
argument. Include member functions to increase the count by one and to
decrease the count by one.

Be sure that no member function allows the value of the counter to become
negative.

Also, include a member function that returns the current count value and
one that outputs the count. Embed your class definition in a test program
and run sufficient tests to verify it all works correctly.

 
  //This is for you guys who like a challenge to figure out. 
This sounds more like a homework assignment than a challenge. If it is a challenge it is a very simple task. All it does is add or subtract one from a unsigned number. If this is though somehow a challenge and not a homework assignment (I am a bit skeptical) I would suggest you move it to the lounge instead of beginner section.
closed account (j3Rz8vqX)
Stop multi-posting:
http://www.cplusplus.com/forum/beginner/130695/
I'll be honest, I don't know comp sci. I just need this to be done to get through the class. Be a bro?


http://www.cplusplus.com/forum/general/130696/
I'll be honest, I'm too busy evaluating triple integrals, analyzing line integrals, calculating three dimensional density functions, and getting research papers published to have to deal with my beginners comp sci class, when it's just a gen ed. I was hoping, since it's so easy, someone could type it up for me in no time


Go look in the job section, maybe someone will do [work step by step on] it for [with] you... (=D)

Otherwise, 100% production of code isn't promoted.
Last edited on
Go look in the job section, maybe someone will do it for you...
No, please don't. If it is a homework assignment they need to do it themselves. This is not a site to help not to spoon feed. I also do not condone academic cheating. academic cheating can also will get you kicked out of your school which I 100% agree with when people try to get things they do not earn.
Last edited on
These are all assumptions, first. Everyone needs help with the basics and fundamentals, thought you'd enjoy a refresher. Sorry.
No, we don't enjoy when someone tries to trick us into doing an assignment, nor do we like it. If you need help feel free to ask, though I will not personally help you with this assignment. Someone else might be willing to help you if you show some effort.
compscifordummies wrote:
These are all assumptions, first.

Like the assumption you've made that your time is more valuable than ours?
Topic archived. No new replies allowed.