// //**********************************************************************************
//File Name: averages.cc
//Description: Calculate the smallest, largest, and the average of the input values.
//Date: 10-6-09
//**********************************************************************************
#include <iostream>
#include <string>
using namespace std;
int main() {
string line;
int min=2000000;
int max=0;
double avg;
int next;
double sum = 0;
double count = 0;
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(7);
cin>> next;
while (!cin.eof()){
getline(cin,line)=next;
if (!cin.fail()) {
if (next < min)
min = next;
if (next > max)
max = next;
count++;
sum=sum+next;
}
}
avg=sum/count;
cout << min;
cout << max;
cout << avg;
}
i get the error:
averages.cc:30: error: no match for 'operator=' in 'std::getline [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>](((std: :basic_istream<char, std::char_traits<char> >&)(&std::cin)), ((std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)(&line))) = next'/usr/sfw/lib/gcc/i386-pc-solaris2.10/3.4.3/../../../../include/c++/3.4.3/iosfwd:62: note: candidates are: std::basic_istream<char, std::char_traits<char> >&std::basic_istream<char, std::char_traits<char> >::operator=(const std::basic_istream<char, std::char_traits<char> >&)bash-3.00$
plz i need help!