link list to store student ID, and gpa

So I have to store a student Id and gpa and name in a linked list. I keep getting error messages. Like: lab 20.cpp(43): error C2628: 'Student' followed by 'int' is illegal (did you forget a ';'?)
(43): error C3874: return type of 'main' should be 'int' instead of 'Student'
(71): error C2664: 'Student::Student(const Student &)' : cannot convert parameter 1 from 'int' to 'const Student &'
Reason: cannot convert from 'int' to 'const Student'
No constructor could take the source type, or constructor overload resolution was ambiguous

I'm really confused and use any help. Thank you in advance.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string>

using namespace std;

struct Student {
	string name;
	double gpa;
	int id;
	Student *next;
}

/*void Student addStudent(Student *root_node) {
	string new_name = "Benny";
	float new_gpa = 3.13;
	int new_id = 0001;

	new_node = root_node;
	if (new_node != null) {
		while (new_node->next != null) {
			new_node = new_code->next;
		}
	}
	cout << "Enter the student's name: ";
	cin >> new_name;

	cout << "Enter the student's GPA: ";
	cin >> new_gpa;

	cout << "Enter the student's ID: ";
	cin >> new_id;
	new_node->next = new Student;
	new_node->name = new_name;
	new_node->gpa = new_gpa;
	new_node->id = new_id;
	new_node->next = 0;

}*/

int main()
{
	string new_name = "Jasmine";
	double new_gpa = 3.35;
	int new_id = 1;

	Student *root;
	Student *new_node;
	root = new Student;
	root->next = 0;
	//addStudent(*root);
	new_node = root;
	while (true) {
		
		
		if (new_node != 0) {
			while (new_node->next != 0) {
				new_node = new_node->next;
			}
			new_node->next = new Student;
			new_node = new_node->next;
			new_node->next = 0;
			new_node->gpa = new_gpa;
			new_node->id = new_id;
			
		}
		break;
	}
	cout << new_node->name << endl;
	return 0;
}
1
2
3
4
5
6
struct Student {
	string name;
	double gpa;
	int id;
	Student *next;
}; //<<-----------------------add this ';' 
Topic archived. No new replies allowed.