i got errors

hello.cpp:27: error: expected primary-expression before ??token
hello.cpp:29: error: expected primary-expression before ??token
hello.cpp:31: error: expected primary-expression before ??token

what's wrong!? help me!!

#include <iostream>
#include <iomanip>
#include <cmath>
#include <fstream>

using namespace std;

void minMax(const double [], int, double&, double&);
void numMeasures(const double [], int, double&, double&);
void getData(fstream&, double [], int&);

int main()
{
   double count, min, max, mean, var;
   count = 25;
   double data[25];

   ifstream dataFile;
   dataFile.open("sewage.data");
   if(dataFile.fail())
      {
         cout<<"file did not open, please check it"<<endl;
         system("pause");
         return 1;
      }

   getData(dataFile, data[], count);

   minMax(data[], count, min, max);

   numMeasures(data[], cout, mean, var);

   system("pause");
   return 0;
}



void minMax(const double data[], int count, double& min, double& max)
{
  ................
}

void numMeasures(const double data[], int count, double& mean, double& var)
{
  ................
}
   
void getData(fstream& dataFile, double data[], int& count)
{
  ................
}

Recommended Answers

All 3 Replies

This isn't a code snippet. It's a regular thread.

getData(dataFile, data[], count);

Function calls shouldn't have the [] in them. Function prototypes do, but not function calls. Delete the [] in the function call and try recompiling.

On line 31 you are trying to pass "cout" instead of "count" to your method.

line 27 ur third parameter is double but in the prototype it is int

i think all ur errors are cuz of that, make sure ur var. type is the same when u call a function and what you have in ur function prototype

eg:

void readData(int, double, int);

readData(x,y,z)

ur x has to be an int, y had to be a double and z has to be an int

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.