PLease write a better code which is rather advance form using #include<queue> && #include<list>

#include<iostream>
#include<conio.h>
#include <iomanip.h>

using namespace std;

const int size=20;

// Patient Class

class Patient
{

      int age;

      char name[30],phy; 

      public:

      Patient()
      {

      age=0;

      strcpy(name,"");

      phy=NULL;

      }

      void SetName(char* P_name)
      {

      strcpy(name,P_name);

      }

      void SetAge(int P_age)
      {

      age=P_age;

      }

      void SetPhyscian(char P1)
      {

      phy=P1;        

      } 

      char* GetName()
      {

      return name;

      }

      int GetAge()
      {

      return age;

      }             

      char GetPhyscian()
      {

      return phy;

      }
};

// Patient Queue Class    

class PatientQueue
{

      int front;

      int rear;

      int noElements;

      Patient array[size];

      int total_patients;

      public:

      PatientQueue()
      {

      rear=0;

      front=0;

      noElements=0;

      total_patients=0;

      }

      void Add_Patient(Patient p)
      {

      if(!isFull())

      {

      rear = (rear + 1) % size;

      array[rear] = p;

      noElements = noElements + 1;

      total_patients++;

      }
      else

      cout<<endl<<endl<<"Your physician's maximum patient limit has reached . No more patients can be treated now"<<endl<<endl;

      }

      void dequeue()
      {

      if(isEmpty())

      cout<<endl<<"Patient Queue is Empty"<<endl<<endl;

      else

      {

      cout <<left<<setw(20)<< "Name"  <<setw(20)<< "Age"<<setw(20)<<"Physician Name";

      cout<<endl<<"============================================================================="<<endl <<endl;

      for (int i=0; i<total_patients; i++) 
      {

      front = (front + 1) % size;

      cout <<left <<setw(20)<<array[front].GetName() <<setw(20)<< array[front].GetAge()<<setw(20)<<array[front].GetPhyscian()<<endl;

      noElements = noElements - 1;

      }

      cout<<endl<<endl<<"==========================================================================="<<endl <<endl;

      }

      }

      void Display_Patient_Phy1() 
      {

      dequeue();

      }

      void Display_Patient_Phy2() 
      {

      dequeue();

      }

      bool isFull()
      {

      return noElements == size;

      }

      bool isEmpty()
      {

      return noElements == 0;

      }

      int Total_Patients()
      {

      return total_patients;
      }


};

// Main() Function

int main()
{

    int age,choice,total;

    char ch,name[25];

    PatientQueue Q[2];

    while(choice!=5)
    {

    cout<<"*******************Menu*************************"<<endl<<endl;
    cout<<"1: Register a new patient"<<endl<<endl;
    cout<<"2: Display List of Patients treated by Physician A"<<endl<<endl;
    cout<<"3: Display List of Patients treated by Physician B"<<endl<<endl;
    cout<<"4: Display Total number of patients served"<<endl<<endl;
    cout<<"5. Exit"<<endl<<endl;
    cout<<"*************************************************"<<endl<<endl;

    cout<<"Enter your choice"<<endl<<endl;

    cin>>choice;

    switch(choice)
    {

    case 1:

    while(ch!= 'n' &&ch!= 'N')

    {                 

    cout<<endl;

    cout<<"Enter Patient Name: "; 

    cin>>name;

    cout<<endl<<endl;

    cout<<"Enter Patient Age:  "; 

    cin>>age;

    Patient p;

    p.SetName(name);

    p.SetAge(age);


    if(age<50)

    {

    p.SetPhyscian('A');

    Q[0].Add_Patient(p);

    }

    else

    {

    p.SetPhyscian('B');

    Q[1].Add_Patient(p);

    }

    cout<<endl<<"Do you want to enter another patient (y/n)? "<<endl<<endl;

    cin>>ch;

    cout<<endl;
    }


    break;

    case 2:

    system("cls");

    Q[0].Display_Patient_Phy1();

    break;

    case 3:

    system("cls");

    Q[1].Display_Patient_Phy2();

    break;

    case 4:

    total= Q[0].Total_Patients()+ Q[1].Total_Patients();

    if(total==0)

    cout<<endl<<endl<<"No Patient Served"<<endl<<endl;

    else

    cout<<endl<<endl<<"Total Patients serveded are: "<<total<<endl<<endl; 

    break;

    case 5:

    cout<<endl<<endl<<"Thanks for using this program"<<endl<<endl;

    break;

    default:

    cout<<endl<<endl<<"Use only options 1-5 "<<endl; 

    }

    }

    system("pause");

    return 0;
}

Martimo
This is My code The one above is a solution file from the Univ for another assinment that I have not submitted It did not compile and deadlive was over
this one is also an assinement so mark the numbers . I want to know how bad is my style of coding. lol

#include<iostream> 
#include <stdlib.h> 
#include<string>
using namespace std;

class Node
{
 private:
 string  name;
 Node * nextNode;
 int obj;
 int interview;
 int total;
 public:
 int goTot(){return total;}
 void setTot(int total){this->total=total;}
 string get() { return name; };
 void set(string name) { this->name = name; };
 int getObj(){return obj;   }
 void  setObj(int obj){this->obj=obj;   }
 int gotSub(){return interview;}
 void setSub(int interview){this->interview=interview;}
 Node * getNext() { return nextNode; };
 void setNext(Node * nextNode) { this->nextNode = nextNode; };
 ~Node(){cout<<"\nNode memory has been released"; }};
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class List
{
public:
List();
void add(string  addObject,int obj , int subject);
string getNam();// get for name
int getTmarks();//get for test marks
int getInvMarks();//get for interview marks
int getTotal();// get for total of test and interview marks
bool next();
int getsise(){return size;  }
friend void traverse(List list);
friend Node* analise(List list);
friend List addNodes();
~List(){}
private:
int size;
Node * headNode;
Node * currentNode;
Node * lastCurrentNode;
};
//....................................................................................................................
List::List()
{
headNode = new Node();
headNode->setNext(NULL);
currentNode = NULL;
lastCurrentNode = NULL;
size = 0;}

void List::add(string addObject,int Addobj, int addSubject)
{
Node * newNode = new Node();
newNode->set(addObject); 
newNode->setObj(Addobj);
newNode->setSub(addSubject);
newNode->setTot(Addobj + addSubject);
if (currentNode != NULL)
{
newNode->setNext(currentNode->getNext());
currentNode->setNext(newNode);
lastCurrentNode = currentNode;
currentNode = newNode;}
else
{
newNode->setNext(NULL);
headNode->setNext(newNode);
lastCurrentNode = headNode;
currentNode = newNode;
}
size++;
}

string List::getNam()
{
if (currentNode != NULL)
return currentNode->get();
}
int List::getTmarks(){ if (currentNode != NULL) {return currentNode->getObj();}}
int List::getInvMarks(){if (currentNode != NULL){   return currentNode->gotSub();}}
int List::getTotal(){List list;if (currentNode != NULL){return currentNode->goTot();}}
bool List::next(){if (currentNode == NULL) return false;    lastCurrentNode = currentNode;
currentNode = currentNode->getNext();   if (currentNode == NULL || size == 0){return false;}
else {return true;  }}
Node* analise(List list){ 
Node* savedCurrentNode = list.currentNode;
list.currentNode = list.headNode;
int max=0;
Node*ptr=NULL;
for(int i=0;i<=list.getsise();i++){
int sum=list.getTmarks()+list.getInvMarks();
if(sum>max)
{max=sum; 
ptr=list.currentNode;}
list.next();
}
return ptr;}
void traverse(List list)
{cout<<"   Name     Test.Marks   Interview.Marks  Total.Marks \n";
cout<<endl;
Node* savedCurrentNode = list.currentNode;
list.currentNode = list.headNode;
for (int i = 0; list.next(); i++){
cout << "   "<<list.getNam();cout<<"\t"<<list.getTmarks();
cout<<"           "<<list.getInvMarks();     
cout<<"             "<<"    "<<list.getTmarks()+list.getInvMarks();       
cout<<endl;}
cout<<endl;
cout<<endl;
cout << "\n   Total Candidates = " << list.size <<endl<<endl;

list.currentNode = savedCurrentNode;}
List addNodes()
{   List list;  int i;  string x;   int y;  int v;  
cout<<"\nInterview Program VU.x.i\n\n";
cout << "...................Candidate List And Test Results.................\n\n\n";
string sum="p";
while(sum=="P"||sum=="p"){  
for (i = 1; i<2; i++){       
cout<<"   Enter Candidate  Name  ";
cin >>x;
cout<<"   Test Marks               ";
cin>>y;
cout<<"   Interview marks          ";
cin>>v;
list.add(x,y,v);}
cout<<endl;
cout<<"   For Another Entry type ( P ) then Enter";
cout<<endl;
cout<<"   For print  type        ( O ) then Enter      ->";
cin>>sum;
cout<<endl;}  return list;}
/////////////////////////////////////////////////////////////////////////////////////////////////////
int main(){
List list = addNodes(); 
traverse(list);
Node*ptr=analise(list);
if(ptr != NULL){
cout<<"   Candidate "<<ptr->get()<<" marks are "<<ptr->goTot();
cout<<endl;
cout<<"   and "<<ptr->get()<<"  has been Selected for Job ";}
cout<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<"   Thanks for using VU interview software";
cout<<endl;
cout<<"   Copy Right VU 2014 Fall Cs301 program ";
cout<<endl;
cout<<endl;
system("pause");
return 0;
}

Edited 1 Year Ago by bc230201818: message was not included

It is so strange.
A professional Software developer will never ever tell anthing to the newBies
and will always smack the question back. You know My elder son is a senior Software engeneer , and the youngest is In the fifth semester of Software engeneering, and they will never answer my question ever.
I am in the fourth semester by the way. so by the virtue of education the junior most.
What I have felt is that it is a very sincere community and wants the newBies to learn. :)

This question has already been answered. Start a new discussion instead.