Here is the code as well as the output, it only takes the student name once.
#include <iostream>
#include<string>
using namespace std;
struct record
{
    string name;
    int marks[6];
    int total=0;
};
int index = 5;
record recorder[5];
void adder(record a[], int index)
{
    for (int i = 0; i < index; i++)
    {
        
        cout << "Enter the Student Name:\n";
            cin.clear();
        getline(cin, a[i].name);
        for (int j = 0; i < 6; i++)
        {
            cout << "Enter the " << j << " Subject Marks";
            cin >> a[i].marks[j];
        }
        for (int j = 0; i < 6; i++)
        {
            a[i].total += a[i].marks[j];
        }
    }
}
int comparer(record a[],int index){
    int i=0;
    int totalfn =0;
    while (i<index)
    {
        if (a[i].total>totalfn)
        {
            totalfn= a[i].total;
        }
        index++;
    }
    return totalfn;
}
void toppercalc(record a[] , int index ,int topper){
    for (int i = 0; i < index; i++)
    {
        if (topper == a[i].total)
        {
            cout<<a[i].name;
            return;
        }
        
    }
    
}
int main()
{
adder(recorder,index);
int topper = comparer(recorder,index);
toppercalc(recorder ,index , topper);
    return 0;
}
Enter the Student Name:
mary
Enter the 0 Subject Marks
33
Enter the 0 Subject Marks
4
Enter the 0 Subject Marks
3
Enter the 0 Subject Marks
2
Enter the 0 Subject Marks
3
Enter the 0 Subject Marks
4
Enter the Student Name:
alina
Enter the 1 Subject Marks
33
Enter the 1 Subject Marks
4
Enter the 1 Subject Marks
3
Enter the 1 Subject Marks
2
Enter the 1 Subject Marks
3
Enter the 1 Subject Marks
4
 
    