SOS please, how to fix this code : ## SOS please, how to fix this code ##
----------
[Error] a function-definition is not allowed here before '}' token

[Error] expected '}' at the end of input

I don't know what's the problem with my code even though I've already checked the compiler errors

    #include<iostream>

    using namespace std;

    struct name_type
    {
    	string first,middle,last;
    };
    
    struct SD
    {
    	name_type name;
    	float grade;
    };
    
    const int MAX_SIZE = 35;
    
    int isFull(int last) {
    	if(last == MAX_SIZE - 1) {
    		return(1);
        }
        else {
        	return(0);
    	}
    }
    int isEmpty(int last) {
    	if(last < 0) {
    		return(1); 
    	}
    	else {
    		return(0);
    	}
    }
    	
    
    main()
    {
        SD SD2[MAX_SIZE];
        int last = -1;
        
        if(isEmpty(last)) 
    	{
        	cout << "List is empty\n";
    	}
    	
    	for (int a=0; a <35; a++)
    	{
    		cout << "Enter first name:.....";
    		cin >> SD2[a].name.first;
    		cout << "Enter middle name:....";
    		cin >> SD2[a].name.middle;
    		cout << "Enter last name:......";
    		cin >> SD2[a].name.last;
    		cout << "Enter your grade:.....";
    		cin >> SD2[a].grade;
    		cout << '\n';
    	}
    	system("cls");
    	cout << "1 - Add";
    	cout << "2 - Delete";
    	cout << "3 - Search";
    	cout << "4 - Print";
    	cout << "5 - Exit";
    	
    	string lname, fname;
    	int choice, search;
    	cin >> choice;
    	
    	if(choice == 3) {
    		cin >> fname;
    		cin >> lname;
    		int index = search;
    		(SD2, lname, fname, last);
    		
    		if (index > 0) {
    			cout << "ERROR\n";
    		}
    		else {
    			cout << "The grade of " << lname << "," << fname << "is " << SD2[index].grade;
    		}
    	}
    	
    	int search(SD list [], string search_lname, string search_fname, int last) {
    		int index;
    	    if(isEmpty(last)==1) {
    		    cout << "\nThe list is Empty!";
    	    }
    	    else {
    		    index = 0;
    	        while(index!= last+1 && list[index].name.first != search_fname && list[index].name.last != search_lname) {
    			    ++index;
    	        }
    	        if(index != last + 1) {
    		        cout << "\nItem Requested is Item" << index + 1 << ".";
    		        return index;
          	    }
    	        else {
    		        cout << "\n Item Does Not Exist.";
    	        }
    	    
    	    }
    	    return -1; // list is empty or search item does not exist
        }
        
    }