I want to clear the screen after select option, but I don't know somehow it is not working. It will show the things in Display() function and the Create New Purchase and other things. It is because in the while loop?
while (selection != -1) // While for create new purchase
{
cout << "Create New Purhcase" << endl << endl;
cout << "1. Display Item" << endl;
cout << "2. Create a New Purchase" << endl << endl <<endl;
cout << "0. Back to Main Menu" << endl;
cout << "Enter Option:";
cin >> selection;
//Back to main menu
if (selection == 0)
{
system("CLS");
break;
}
if (selection == 1)
{
system("CLS");
cout << "Display Menu" << endl;
Display();
}
void Display()
{
system("CLS");
temp = itemHead; //start at the first node
cout << "Dispaly Menu" << endl << endl;
while (temp != NULL)
{
cout << "ID:" << temp->itemid << endl;
cout << "Item Name:" << temp->name << endl;
cout << "Item Type:" << temp->type << endl;
cout << "Item Price" << temp->cost << endl;
cout << endl << endl;
temp = temp->next; //forward to the next node
}
}