#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
using std::cout;
using std::cin;
using std::vector;
using std::endl;
using std::sort;
int main(){
vector<double> notes;
cout<<"Enter some notes and hit ctrl+D followed by an <enter> to stop: ";
double input;
while(cin >> input){
notes.push_back(input);
}
cout<<endl<<"Entered notes: ";
for(int i=0; i<notes.size(); ++i){
cout<<notes[i]<<" ";
}
sort(notes.begin(), notes.end());
cout<<endl<<"Min: "<<notes[0]<<" Max: "<<notes[notes.size()-1];
double sum, avg = 0;
for(int i=0; i<notes.size(); ++i){
sum +=notes[i];
}
avg = sum/notes.size();
cout<<"\nThe avg is: "<<avg;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y3N0cmluZz4KI2luY2x1ZGUgPHZlY3Rvcj4KI2luY2x1ZGUgPGFsZ29yaXRobT4KdXNpbmcgc3RkOjpjb3V0Owp1c2luZyBzdGQ6OmNpbjsKdXNpbmcgc3RkOjp2ZWN0b3I7CnVzaW5nIHN0ZDo6ZW5kbDsKdXNpbmcgc3RkOjpzb3J0OwoKCgppbnQgbWFpbigpewogICAgdmVjdG9yPGRvdWJsZT4gbm90ZXM7CiAgICBjb3V0PDwiRW50ZXIgc29tZSBub3RlcyBhbmQgaGl0IGN0cmwrRCBmb2xsb3dlZCBieSBhbiA8ZW50ZXI+IHRvIHN0b3A6ICI7CiAgICBkb3VibGUgaW5wdXQ7CiAgICB3aGlsZShjaW4gPj4gaW5wdXQpewogICAgICAgIG5vdGVzLnB1c2hfYmFjayhpbnB1dCk7CiAgICB9CiAgICAKICAgIGNvdXQ8PGVuZGw8PCJFbnRlcmVkIG5vdGVzOiAiOwogICAgZm9yKGludCBpPTA7IGk8bm90ZXMuc2l6ZSgpOyArK2kpewogICAgICAgIGNvdXQ8PG5vdGVzW2ldPDwiICI7CiAgICB9CiAgICBzb3J0KG5vdGVzLmJlZ2luKCksIG5vdGVzLmVuZCgpKTsKICAgIAogICAgY291dDw8ZW5kbDw8Ik1pbjogI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