Write a program that creates a simple linked list of N integers taken from the INPUT file. The last number entered is one. These numbers will be ordered (simultaneously with the reading) in descending order by operations on the elements and then will be displayed.
I wrote the program but i can't figure out how to take the input from the file and
order the numbers.
In C++, there's no need to specifiy struct before referring to the name of a struct. L8 becomes:
typedef nod* List;
or as C++:
using List = nod*;
Add() needs to insert the element into the correct sorted position in the list. Iterate over the list until the position is found in which the new item should be inserted and then insert it there.
As you are using struct for the node, why not use a struct/class for the List when Add(0 etc would become class member functions?