Question: Write a program in C++ please 3. Write the necessary member functions to create a counter class which counts from zero to a maximum then

Write a program in C++ please
3. Write the necessary member functions to create a counter class which counts from zero to a maximum then back down to zero. Do not modify the main program. You must write the prototypes and the definitions of the methods of the class. Declaration of Class Updown /* File: updown.h A class representing a simple counter which counts up from 0 to a maximum value and then counts back down to 0 at which point the process repeats */ \#ifndef UPDOWNH \#define UPDOWNH \#include iostream \#include > using namespace std ; class updown \{ private: int max; // count cycles between 0 and max int direction; //1 means count up, o means count down int value; this is the value stored in the counter public: // you fill in the method prototypes \#endif /*UPDOWN_H*/ Implementation of Class Updown F* File: updown. cpp Implementation of class updown */ \#include "updown.h" Main Program Using Class Updown Programmer: your name Date: \#include "updown. h" int main (void) ofstream fout ("updownout.txt"); // prepare the output file // c.value =0,c.direction =1 and cmax=7/ for (i=1;i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
