for this school project we had to make a linked list out of information we got from a file with this information.
Name:       ID:         GPA:
Alice       8234        2.7
mark        2672        3.0
Joanne      1234        3.7
John        3291        2.0
Tim         3212        3.8
Alford      1034        2.7
Benson      6290        2.5
Nancy       4234        3.7
Oscar       1672        1.0
Larry       1004        2.7
I got this information into a data structure. Now i am trying to use the id variable of the structure as the sorting key to the linked list, but i keep getting an error in my void list::addnode(node key) function with the variable key
#include<iostream>
#include<string>
#include<fstream>
#include<cstdlib>
using namespace std;
typedef struct node
    {
        string name;
        int id;
        float gpa;
        node *next;
    }*nodePtr; 
    node nodeinfo[10];
    nodePtr head;
    nodePtr current;
    nodePtr temp;
class list {
public:
    list();
    void addNode(node);
    void deleteNode(int delData);
    void displayList();
};
list::list() {
    head = NULL;
    current = NULL;
    temp = NULL;
}
void list::addNode(node key) {
    nodePtr n = new node;
    n->next = NULL;
    n->id = key;
    if (head != NULL)
    {
        current = head;
        while (current->next != NULL)
            current = current->next;
        current->next = n;
    }
    else
        head = n;
}
void list::deleteNode(int delData) {
    nodePtr delPtr = NULL;
    temp = head;
    current = head;
    while (current != NULL && current->id != delData) {
        temp = current;
        current = current->next;
    }
    if (current == NULL) {
        cout << delData << " is not in the list\n";
        delete delPtr;
    }
    else
    {
        delPtr = current;
        current = current->next;
        temp->next = current;
        delete delPtr;
        cout << "the value " << delData << "is no longer in the list\n";
    }
}
void list::displayList() {
    current = head;
    while (current != NULL)
    {
        cout << current->id << endl;
        current = current->next;
    }
}
int main() {
    fstream datafile("studentdata.txt");
    list studentinfo;
    node student;
    if (!datafile)
    {
        cout << "Error!!";
        exit(1);
    }
    for (int i = 0; i < 10; i++) {
        datafile >> nodeinfo[i].name >> nodeinfo[i].id >> nodeinfo[i].gpa;
    }
    studentinfo.addNode(student);
    return 0;
}
