Good, I don't understand why the program doesn't compile, besides that, I have no idea how much it has to show the grades, it also gives me the average of the grades and what is the highest and lowest grade.
Showing the notes in an orderly way is superfluous, it's not necessary, I just added it for aesthetics, and I don't know if I'm implementing the functions correctly in the code.
Also, if more improvements can be implemented, I would greatly appreciate it.
struct nodo {
int dato;
nodo *siguiente;
}
void insertarLista(Nodo *& int );
void mostarLista(Nodo *);
int main() {
nodo *lista = NULL;
int dato;
menu();
getch();
return 0;
}
void menu() {
int opcion
do {
cout << "MENU: ";
cout << "1. Insertar Nota ";
cout << "2. Mostar Notas ";
cout << "3. Salir ";
cin >> opcion;
switch (opcion) {
case 1:
cout << "Ingrese Las Notas: ";
cin >> dato;
insertarLista(Lista, dato);
cout << "\n";
system("pause");
break;
case 2:
MostarLista(lista);
cout << "\n";
system("pause");
break;
}
system("cls");
}
while (opcion != 3);
}
void insertarLista(Nodo *&lista, int n) {
Nodo *nuevo_nodo = new Nodo();
nuevo_nodo->dato = n;
Nodo *aux1 = lista;
Nodo *aux2;
while ((aux1 != NULL) && (aux1->dato < n)) {
aux2 = aux1;
aux1 = aux1->siguiente;
}
if (lista == aux1) {
lista = nuevo_nodo;
} else {
aux2->siguiente = nuevo_nodo;
}
nuevo_nodo->siguiente = aux1;
}
void mostrarLista(Nodo *lista) {
Nodo *acual = new nodo();
actual = lista;
while (actual != NULL) {
cout << actual->dato << " -> ";
}
}