コード例 #1
0
ファイル: main.cpp プロジェクト: hamdih/2015_2016
	void remove(string pick)
	{
	student *now = head;
	if(now !=NULL)
	{
	student *picked = head->getNext();
	}
	student *before = head;
	student *here = NULL;
	while(now!=NULL)
		{

		if(pick == now->getName())
			{
				if(now == head)
					{	
						here = head;
						head = here->getNext();
						delete here;	
						cout<<"Removal Succesfull";
						return;
					}
				before = now->getNext();
				delete now;
				cout<<"Removal Sucessful";
				return;
			}		
			before = now;
			now = now->getNext();	
		

		}
		cout<<"ERROR:Not Found for Removal:"<<pick;
	};
コード例 #2
0
ファイル: HmiH_00_P2_Main.cpp プロジェクト: hamdih/2015_2016
void abc(){					// this function will alphabatize all the students after adding them
	int i;
	for(i = 0;i<(count);i++)
	{
	student *now = head;				
	student *next = head->getNext();		// set up pointers to be compared
	string temp1,temp2;
	if(now->getNext() == NULL)
	{
	return;
	}
	else
		{	
		while(now!= NULL)
			{
			temp1 = now->getName();			// set pointers to newly added student
			temp2 = next->getName();
	
		if(temp1 > temp2)			// compare and change
			{
				now->setName(temp2);
				next->setName(temp1);
			
			}
		if(next->getNext() != NULL)
		{
			next = next->getNext();
		}				// keep looping through students to alphabatize
		now = now->getNext();
			}
		}
	}
};
コード例 #3
0
ファイル: HmiH_00_P2_Main.cpp プロジェクト: hamdih/2015_2016
void search(string find) 	// this function will search for a student in the linked list based on their name
	{
		student *now = head;
		student *found = head->getNext();
		student *before = head;
		student *here = NULL;
		while(now != NULL)				
		{
			if( find == now->getName())	// compare student name to searching name
			{
			cout<<"FOUND:"<<""<<now->getName()<<" "<<"UID:"<<now->getID();
			return;
			}
			else
			before = now;
			now= now->getNext();		
	
		}
			cout<<"NOT FOUND:"<<""<<find;
};
コード例 #4
0
ファイル: main.cpp プロジェクト: hamdih/2015_2016
void search(string find)
	{
		student *now = head;
		student *found = head->getNext();
		student *before = head;
		student *here = NULL;
		while(now != NULL)
		{
			if( find == now->getName())
			{
			cout<<"TRUE:"<<""<<now->getName();
			return;
			}
			else
			before = now;
			now= now->getNext();		
	
		}
			cout<<"FALSE:"<<""<<find;
};