This program is for movie list.
And I made parts of movie program which is searching and adding movie on the list.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
bool SortedMovieList::add ( const MovieType& newMovie )
{
if (numOfMovie < MAX_LIST)
{
movie[numOfMovie++] = newMovie;
returntrue;
}
returnfalse;
}
int SortedMovieList::find ( const MovieType& movieFind ) const
{
for( int i = 0; i < numOfMovie; i++ )
if( movie[i] == movieFind )
return i;
return -1;
}
But I got a wrong because these functions are not sorted.
Ineed to change this code to whole sorted program.
I have an example of sorted insert program, but I don't understand clearly.
Could you help me what should I change?