Using C Can someone show me how to creat a class Orders that

Using C++. Can someone show me how to creat a class (Orders) that consists of 10 tables(array or something else) and do a boolean statement to show if the table is open?

Solution

#include <iostream>
#include <vector>
using namespace std;

class Orders{
   vector<int> tables[10]; //ten tables of type vector
   bool isTableOpened[10]; //initially all tables are closed

public:
   Orders(){
       for(int i =0; i < 10; i++){
           isTableOpened[i] = false;
       }
   }

   void openATable( int tableNo ){
       isTableOpened[tableNo ] = true;
   }

   //This is function you are asking for
   bool isTableOpen( int tableNo ){
       return isTableOpened[tableNo];
   }
}

Using C++. Can someone show me how to creat a class (Orders) that consists of 10 tables(array or something else) and do a boolean statement to show if the table

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site