Question: Can't figure out why I keep getting a no matching function call to line fin.open(filename); Is there something wrong that I am not seeing? The

Can't figure out why I keep getting a no matching function call to line fin.open(filename); Is there something wrong that I am not seeing?

The description of the problem is as follows (more or less):

The program has to ask the user to enter the name of a file. Then, the program opens that file, reads the contents, and then analyzes them. The program should then display the following data:

The sum of the numbers in the file.

The average of the numbers in the file.

The lowest number in the file.

The highest number in the file.

#include #include using namespace std;

int main() {

const int size = 12; double numbers[size]; int count = 0;

string filename; ifstream fin;

cout << "Enter the name of the file you wish to open: "; cin >> filename;

fin.open(filename);

if (fin) { while (count < size && fin >> numbers[count]) { count++; }

fin.close(); } else { cout << "Error opening the file "; }

int value = count;

cout << "There are " << value << "numbers in the array. "; cout << "The numbers are: ";

for (int i = 0; i < count; i++) { cout << numbers[i] << " "; }

cout << endl;

for (int j = 0; j < size; j++) { double min = numbers[0];

if (numbers[j] < min) { min = numbers[j]; } }

for (int k = 0; k < size; k++) { double max = numbers[0];

if (numbers[k] > max) { max = numbers[k]; } }

for (int q = 0; q < size; q++) { double sum = 0.0;

sum += numbers[q]; }

cout << "Min: " << min << endl; cout << "Max: " << max << endl; cout << "Mean: " << (sum / size) << endl; cout << "Total numbers: " << size << end

return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!