I have stumbled upon another issue with some of my classwork. For this part, we have to display the information from a dynamic array in a neat and organized list, where the "empty" spots say empty and the spots that contain someone shows their ID number(passed by the array). My main issue is trying to differentiate between empty and "full", I think at some point in the program I should fill the arrays with -1 but I have not been able to figure that out. Also, I am having a little issue with formatting but id rather have it work in a bad format than not work at all. Below I have attached what code and functions I have, and what the menu should look like. Sorry for any terrible coding or amateur mistakes. I have been working on this for about 6~ hours straight and I'm ready to hear some ideas from someone else. Also if you see something that could be better or cleaned up, don't hesitate to share! I am still quite new to c++ and always looking to get better
void display(int **labPtr);//displays an entire lab
int main()
{
initialDisplay(); //used to display the universities
int userChoice = 0; //used to control menu
//below is code initializing the parallel arrays and pointers
int* labPtr[NUMLABS]={nullptr};
for(auto i=0; i<NUMLABS; ++i){
labPtr[i]=newint[i];
}
string* namePtr[NUMLABS]={nullptr};
for(auto i=0; i<NUMLABS; ++i){
namePtr[i]=new string[i];
}
int* timePtr[NUMLABS]={nullptr};
for(auto i=0; i<NUMLABS; ++i){
timePtr[i]=newint[i];
}
do{
mainMenu(); //displays menu
cout << "Your Choice: ";
cin >> userChoice; //recives choice for the menu
switch (userChoice)
{
case(1):
logIn(labPtr, namePtr, timePtr); //runs login function if chosen
break;
case(2):
logOff(labPtr, namePtr, timePtr); //runs log off function if chosen
break;
case(3):
look(labPtr); //runs the search function if chosen
break;
case(4):
display(labPtr); //displays a chosen lab if chosen
break;
case(5): //closes menu and ends program
break;
}
}while(userChoice != 5);
}
Here is the function that i have bee able to come up with so far but its not even close