All of the work in this project is my own!  I have not left copies of my code in public folders on university computers. I have not given any of this project to others. I will not give any portion of this project to others taking this class. I realize that the penalty for turning in work that is not my own can range from an "F" in the class to dismissal from Trinity University. 

                                    Print Title  ______________________________________    Time Required = ______.____ Hrs.

                                    Signature   ______________________________________    (pledged)


IntArray III Lab
Individual Homework Assignment
35 Points

Tom-Hicks-HW-9.c

1] Create main program  HW-8 and save it as Tom-Hicks-HW-9. Use your own name.


//////////////////////////////////////////////////////////////////////////////
//                              Add Prototypes                              //
//////////////////////////////////////////////////////////////////////////////
void BubbleSortIntArray1 (int Array[], int * ActNo);
void ????SortInArray (int Array[], int * ActNo); //Insert any 
                             //other sort from Your Book. Name it well.
long SequentialSearchIntArray (int Array[], int ActNo, int SoughtValue); 
bool DeleteIntArray (int Array[], int * ActNo, int OldValue); 


//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//                             BubbleSortIntArray1                          //
//                                                                          //
//  Purpose : Use the bubble sort algorithm to sort the array. Remember     //
//            that we are not storing data in Array[0]. Begin with Array[1] //
//            Do nothing if the array is empty.                             //
//                                                                          //
//            |----------------------|                                      //
//          5 |                  123 |                                      //
//            |----------------------|                                      //
//          4 |                    3 |                                      //
//            |----------------------|                                      //
//          3 |                   80 |                                      //
//            |----------------------|                                      //
//          2 |                   16 |                                      //
//            |----------------------|                                      //
//          1 |                  100 |                                      //
//            |----------------------|                                      //
//             ActNo = 5   Max = 1221                                       //
//                                                                          //
// would become:                                                            //
//            |----------------------|                                      //
//          5 |                  123 |                                      //
//            |----------------------|                                      //
//          4 |                  100 |                                      //
//            |----------------------|                                      //
//          3 |                   80 |                                      //
//            |----------------------|                                      //
//          2 |                   16 |                                      //
//            |----------------------|                                      //
//          1 |                    3 |                                      //
//            |----------------------|                                      //
//             ActNo = 5   Max = 1221                                       //
//                                                                          //
//  Written By : Thomas E. Hicks          Environment : Linux               //
//  Date ......: xx/xx/xxxx               Compiler ...: gcc                 //
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
void BubbleSortIntArray1 (int Array[], int * ActNo)
{

	

}

//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//                             ???????SortIntArray                          //
//                                                                          //
//  Purpose : Use any other sort, demonstrated in your textbook, to sort    //
//            the array. Name the sort appropriately.  Remember             //
//            that we are not storing data in Array[0]. Begin with Array[1] //
//            Do nothing if the array is empty.                             //
//                                                                          //
//            |----------------------|                                      //
//          5 |                  123 |                                      //
//            |----------------------|                                      //
//          4 |                    3 |                                      //
//            |----------------------|                                      //
//          3 |                   80 |                                      //
//            |----------------------|                                      //
//          2 |                   16 |                                      //
//            |----------------------|                                      //
//          1 |                  100 |                                      //
//            |----------------------|                                      //
//             ActNo = 5   Max = 1221                                       //
//                                                                          //
// would become:                                                            //
//            |----------------------|                                      //
//          5 |                  123 |                                      //
//            |----------------------|                                      //
//          4 |                  100 |                                      //
//            |----------------------|                                      //
//          3 |                   80 |                                      //
//            |----------------------|                                      //
//          2 |                   16 |                                      //
//            |----------------------|                                      //
//          1 |                    3 |                                      //
//            |----------------------|                                      //
//             ActNo = 5   Max = 1221                                       //
//                                                                          //
//  Written By : Thomas E. Hicks          Environment : Linux               //
//  Date ......: xx/xx/xxxx               Compiler ...: gcc                 //
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
void ?????SortIntArray (int Array[], int * ActNo)
{

	

}

//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//                       SequentialSearchIntArray                           //
//                                                                          //
//  Purpose : Use any other sort, demonstrated in your textbook, to sort    //
//            the array. Name the sort appropriately.  Remember             //
//            that we are not storing data in Array[0]. Begin with Array[1] //
//            Do nothing if the array is empty.                             //
//                                                                          //
//            |----------------------|                                      //
//          5 |                  123 |                                      //
//            |----------------------|                                      //
//          4 |                    3 |                                      //
//            |----------------------|                                      //
//          3 |                   80 |                                      //
//            |----------------------|                                      //
//          2 |                   16 |                                      //
//            |----------------------|                                      //
//          1 |                  100 |                                      //
//            |----------------------|                                      //
//             ActNo = 5   Max = 1221                                       //
//                                                                          //
//         SequentialSearch for 3 returns 4                                 //
//         SequentialSearch for 80 returns 3                                //
//         SequentialSearch for 5 returns 0                                 //
//         SequentialSearch for 123 returns 5                               //
//                                                                          //
//  Written By : Thomas E. Hicks          Environment : Linux               //
//  Date ......: xx/xx/xxxx               Compiler ...: gcc                 //
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
long SequentialSearchIntArray (int Array[], int ActNo, int SoughtValue)
{

	

}

//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//                              DeleteIntArray                              //
//                                                                          //
//  Purpose : Use any other sort, demonstrated in your textbook, to sort    //
//            the array. Name the sort appropriately.  Remember             //
//            that we are not storing data in Array[0]. Begin with Array[1] //
//            Do nothing if the array is empty. Sort Order not important.   //
//            Explicitly return true if able to find and delete the         //
//            OldValue; otherwise return false.                             //
//                                                                          //
//            |----------------------|                                      //
//          5 |                  123 |                                      //
//            |----------------------|                                      //
//          4 |                    3 |                                      //
//            |----------------------|                                      //
//          3 |                   80 |                                      //
//            |----------------------|                                      //
//          2 |                   16 |                                      //
//            |----------------------|                                      //
//          1 |                  100 |                                      //
//            |----------------------|                                      //
//             ActNo = 5   Max = 1221                                       //
//                                                                          //
// 	Delete 16 might do                                                  //
//            |----------------------|                                      //
//          4 |                  100 |                                      //
//            |----------------------|                                      //
//          3 |                   80 |                                      //
//            |----------------------|                                      //
//          2 |                  123 |                                      //
//            |----------------------|                                      //
//          1 |                    3 |                                      //
//            |----------------------|                                      //
//             ActNo = 4   Max = 1221                                       //
//                                                                          //
// 	Delete 3 might do                                                   //
//            |----------------------|                                      //
//          3 |                   80 |                                      //
//            |----------------------|                                      //
//          2 |                  123 |                                      //
//            |----------------------|                                      //
//          1 |                  100 |                                      //
//            |----------------------|                                      //
//             ActNo = 3   Max = 1221                                       //
//                                                                          //
//  Written By : Thomas E. Hicks          Environment : Linux               //
//  Date ......: xx/xx/xxxx               Compiler ...: gcc                 //
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
void DeleteIntArray (int Array[], int * ActNo, int OldValue)
{

	

}
 
TestHW8

1] Rename the old main to be TestHW8. See Below!

//////////////////////////////////////////////////////////////////////////////
//                                   TestHW8                                //
//////////////////////////////////////////////////////////////////////////////
void TestHW8(void);
{	
int 
	Bowling [MAX_BOWLING + 1 ],
	Exams [MAX_EXAMS +1 ];
int
	ActNoBowling,
	ActNoExams;
double
	AvrExams,
	AvrBowling;

	InitializeIntArray(Exams, &ActNoExams, MAX_EXAMS);
	FillIntArrayFromFile (Exams, &ActNoExams, MAX_EXAMS, "Tom-Hicks-Random-1000.txt");
 	DisplayIntArray (Exams, ActNoExams, MAX_EXAMS, MAX_EXAMS, 
 		                 "\nExams: File Filled");	
	Pause();
	InitializeIntArray(Bowling, &ActNoBowling, MAX_BOWLING);
	FillIntArrayFromFile (Bowling, &ActNoBowling, MAX_BOWLING, "Tom-Hicks-Random-1000.txt");
 	DisplayIntArray (Bowling, ActNoBowling, MAX_BOWLING, ActNoBowling, 
 		                 "\n Bowling: File Filled");
	Pause();
	return 0;
}

			
 
Write Function Main

1] Copy and paste the following test function:
 

 

//////////////////////////////////////////////////////////////////////////////
//                                  TestHW9                                 //
//////////////////////////////////////////////////////////////////////////////
TestW9(void)
{	
int 
	Bowling [MAX_BOWLING + 1 ],
	Exams [MAX_EXAMS +1 ],
	SeachLoc,
	ActNoBowling,
	ActNoExams;
double
	AvrExams,
	AvrBowling;

	InitializeIntArray(Exams, &ActNoExams, MAX_EXAMS);
	FillIntArrayRandom (Exams, &ActNoExams, MAX_EXAMS, 1, 10, 10);
 	????SortInArray (Exams, &ActNoExams);
 	DisplayIntArray (Exams, ActNoExams, MAX_EXAMS, MAX_EXAMS, 
		                 "\nExams: Sorted");	
	SeachLoc = SequentialSearchIntArray (Exams, ActNoExams, 5); 
	if (SearchLoc == true)
		printf ("5 is Found in Exams[%d]!\n", SearchLoc);
	else
		puts("5 is Not Found!");

	SeachLoc = SequentialSearchIntArray (Exams, ActNoExams, 6); 
	if (SearchLoc == true)
		printf ("6 is Found in Exams[%d]!\n", SearchLoc);
	else
		puts("6 is Not Found!");

	SeachLoc = SequentialSearchIntArray (Exams, ActNoExams, 1); 
	if (SearchLoc == true)
		printf ("1 is Found in Exams[%d]!\n", SearchLoc);
	else
		puts("1 is Not Found!");

	SeachLoc = SequentialSearchIntArray (Exams, ActNoExams, 11); 
	if (SearchLoc == true)
		printf ("11 is Found in Exams[%d]!\n", SearchLoc);
	else
		puts("11 is Not Found!");
	SeachLoc = SequentialSearchIntArray (Exams, ActNoExams, -1); 
	if (SearchLoc == true)
		printf ("-1 is Found in Exams[%d]\n!\n", SearchLoc);
	else
		puts("-1 is Not Found!\n");
	Pause();
	if (DeleteIntArray (Exams, ActNoExams, 5))
		puts("Deleted Value = 5"); 
	else
		puts("5 is not deleted!"); 
	if (DeleteIntArray (Exams, ActNoExams, 1))
		puts("Deleted Value = 1"); 
	else
		puts("1 is not deleted!"); 

	if (DeleteIntArray (Exams, ActNoExams, 10))
		puts("Deleted Value = 10"); 
	else
		puts("10 is not deleted!"); 
	if (DeleteIntArray (Exams, ActNoExams, 22))
		puts("Deleted Value = 22"); 
	else
		puts("22 is not deleted!"); 
	Pause();
 	DisplayIntArray (Exams, ActNoExams, MAX_EXAMS, MAX_EXAMS, 
		                 "\nDeleted 5, 1, 10, 22");	

	InitializeIntArray(Bowling, &ActNoBowling, MAX_BOWLING);
	FillIntArrayRandom (Bowling, &ActNoBowling, MAX_BOWLING, 0, 300, 200);
 	BubbleSort1InArray (Bowling, &ActNoBowling);
 	DisplayIntArray (Bowling, ActNoBowling, MAX_BOWLING, ActNoBowling, 
 		                 "\n Bowling: Sorted");
	Pause();
	return 0;
}

			

Write Function Main

1] Copy and paste the following test function:

 
//////////////////////////////////////////////////////////////////////////////
//                                    Defines                               //
//////////////////////////////////////////////////////////////////////////////
# define MAX_BOWLING 300
# define MAX_EXAMS 10

//////////////////////////////////////////////////////////////////////////////
//                                      main                                //
//////////////////////////////////////////////////////////////////////////////
int main (int argc, char * argv[])
{	
	TestHW9();
	return 0;
}

			

Copy Files

 
1] Copy file Tom-HW9.c ========================>  to /users/thicks/hw1320/hw9

2] Copy file Tom-Hicks- Utility.h ==============>  to /users/thicks/hw1320/hw9


What To Turn In

1] Signed copy of page 1 of this Lab.

2] Printed copy of only Function FillIntArrayFromFile and the documentation that goes with it.

3] Nothing will be graded until you copy the file into the /users/thicks/hw1320 directory.

4] Nothing will be graded until this lab form is submitted.  Staple the pages. Fold the lab Horizontally (like a hot dog) and write your name nice and large on the outside.  Place it on the professor desk before the beginning of lecture on the day it is due. All assignments are due the next class period unless otherwise designated on the schedule page.