0
#include <iostream>
#include <fstream>
#include <cstdlib>
using namespace std;

class Kmean{
public:
    class Point{
        public:
        double Xcoord;
        double Ycoord;
        int Lable;
        double Distance;
    };
        int k;
        int numPts;
        Point** pointSet;
        int numRows;
        int numCols;
        int** displayAry;
        Point** KcentroidAry;
        int change;

};
int main(int argc,char* argv[]){
    Kmean km;
    ifstream inFile(argv[1]);
    km.k=atoi(argv[2]);
    ofstream outFile1(argv[3]);
    ofstream outFile2(argv[4]);
    inFile>>km.numRows;
    inFile>>km.numCols;
    km.displayAry=new int*[km.numRows][km.numCols];

    //  inFile>>km.numPts;
//  km.pointSet[km.numPts];
//  km.KcentroidAry[km.k+1];
//  km.loadPointSet(inFile,km.pointSet);
//  km.kMeanClustering(km.pointSet, km.k, km.KcentroidAry);
    inFile.close();
    outFile1.close();
    outFile2.close();

}

here is my code, I was trying to declare the km.displayAry and km.point and km.KcentroidAry size, but it says 'km' cannot appear in a constant-expression, i dont know how to fix it ,the size is read from the input file

Rex Huang
  • 1
  • 2

0 Answers0