Example #1
0
int main(){
    // New list
    List list;
	Node *answer;
    // Add_End nodes to the list
    list.Add_End(111);
    list.Print();
    list.Add_End(222);
    list.Print();
    list.Add_End(333);
    list.Print();
    list.Add_End(444);
    list.Print();
    list.Add_End(555);
    list.Print();
	cout << endl << endl;

    // Delete nodes from the list
    list.Delete(444);
    list.Print();
//    list.Delete(333);
//    list.Print();
//    list.Delete(222);
//    list.Print();
//    list.Delete(555);
//    list.Print();
//    list.Delete(111);
//    list.Print();
//    cout<<endl<<endl;
//	
//	cout << "Testing Add_Front: and others"<<endl;
//    list.Add_Front(888);
//    list.Print();
//	list.Add_Front(999);
//	list.Print();
//	list.Add_Front(49);
//	list.Print();
//	cout<<endl<<endl;
	
//	cout << "Checking find function"<<endl;
//	answer = list.Find(888);
//	cout<<"Value for node returned by find function call with 888 is "<<answer->Data()<<"."<<endl;
//	cout<<"Checking find function"<<endl;
//	answer = list.Find(999);
//	cout<<"Value for node returned by find function call with 888 is "<<answer->Data()<<"."<<endl;
//	
//	cout<<"Checking find function"<<endl;
//	answer = list.Find(49);
//	cout<<"Value for node returned by find function call with 888 is "<<answer->Data()<<"."<<endl;
//	cout<<"Call find function with value not in list."<<endl;
//	answer = list.Find(7);
//    if(answer == NULL)
//	{
//		cout<<"returned null pointer since 7 not found"<<endl;
//       	
//	}
//	else
//	{
//	   	cout<< "in else of answer == NULL where Value for node returned by find function call with 7 is "<<answer->Data()<<"."<<endl;
//	}
//	
//	cout<<"testing delete_front: "<<endl;
//	list.Delete_Front();
//	list.Print();
//	cout<<"testing delete_end: "<<endl;
//	
//	list.Delete_End();
//	list.Print();
	
    return 0;
}