Hi, I'm new to the forums and the language. I'm working on an assignment for uni, and am completely stumped as to the source of the error I keep on getting. Here's the problematic code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
#include <iostream>
#include <list>
#include <vector>
using namespace std ;
list<unsigned> & topSort ( istream & idata )
{
int numberOfRecords = 0; // Holds number of records
char list[80];
idata.getline(list, 80);
numberOfRecords = atoi(list);
// Creates a reference to the list which will hold the ordered list of records
list<unsigned> myList = new list<unsigned int>;
list<unsigned> noPList; // Creates a no-predecessor list
// Creates a successor list equal to number of total records
vector<list<unsigned> > successors(numberOfRecords);
|
And here are the error statements:
topSort.cpp: In function 'std::list<unsigned int, std::allocator<unsigned int> >& topSort(std::istream&)':
topSort.cpp:14: error: expected primary-expression before 'unsigned'
topSort.cpp:14: error: expected `;' before 'unsigned'
topSort.cpp:16: error: expected primary-expression before 'unsigned'
topSort.cpp:16: error: expected `;' before 'unsigned'
topSort.cpp:19: error: 'list' cannot appear in a constant-expression
topSort.cpp:19: error: template argument 1 is invalid
topSort.cpp:19: error: template argument 2 is invalid
topSort.cpp:19: error: expected unqualified-id before '>' token
There are more errors further down the code, but they all seem to be linked to these lines of code.
Any help would be greatly appreciated.