Help printing a list.

Here is my code thus far:

#include <iostream>
#include <iomanip>
#include <string>
#include <list>
#include <vector>
#include <sstream>
#include <fstream>
#include <algorithm>
#include <numeric>
using namespace std;
int main()
{
char a;
vector<double> scores;
int s, n, i;
int max = 0;
int min = 0;
double sum = 0;
double num = 0;
double avg;
double median = 0;
float avesum;
std::list<int> mylist;

ifstream inFile;
inFile.open("scores.dat");

inFile >> s;
while(inFile)
{
scores.push_back(s);
inFile >> s;
}

sum = accumulate(scores.begin(), scores.end(), sum);
num = scores.size();
avg = sum/num;

for (int i = s; i <= num; i++) mylist.push_back(i);
mylist.sort();

cout << "Sum: " << sum << endl << "Number of scores: " << num << endl << "Average: " << avg << endl;

cin >> a;
return 0;
}

*****************************
How do I go about printing out mylist?
Use a for-loop and iterators

Look at the example code here:

http://www.cplusplus.com/reference/list/list/begin/
Thanks, I will give it a shot.
Topic archived. No new replies allowed.