Skip to content

Instantly share code, notes, and snippets.

Created September 29, 2016 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/a90f03aa6d0f56a6fd7601bccb66e40b to your computer and use it in GitHub Desktop.
Save anonymous/a90f03aa6d0f56a6fd7601bccb66e40b to your computer and use it in GitHub Desktop.
/*********************************************
This is a modification of the Cqueue class
for the Josephus Problem. The class variable
Queue is an array of strings (for names).
*********************************************/
#include <cstring>
#include <string>
using namespace std;
class Cqueue2
{
private:
int Rear, Front;
string * Queue;
int Max;
int Size;
public:
Cqueue2(int n);
~Cqueue2();
int Is_Empty();
int Is_Full();
void Add(string Element);
string Delete();
string getFront();
void write_Cqueue_to_Console(); //write all of the class variables to the console
int get_size(); //this function is added to Cqueue2 so can tell when have 1 member in the queue
string remove_nth_member(int n); //for Josephus problem to remove a member
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment