C++ Parameterized constructor error

File Perceptron.h:

class Perceptron
{
public:
Perceptron(){};
Perceptron(int);
int feedforward(float[]);
float randomFloat(int, int);

float* weights;

};
File Perceptron.cpp:
#include <cstdlib>
#include <iostream>

#include <Perceptron.h>

using namespace std;

public Perceptron::Perceptron(int size){
weights = new float[size];
//ctor
for (int i = 0; i < size; i++) {
//The weights are picked randomly to start
weights[i] = randomFloat(-1,1);
cout << "weight[" << i << "]=" << weights[i] << endl;
}
}
// Random number generator between min and max
public float Perceptron::randomFloat(int min, int max)
{
float r = (float)rand() / (float)(RAND_MAX+1.0);
return min + r * (float)(max - min);
}
public int Perceptron::feedforward(float inputs[], int len) {
float sum = 0;
for (int i=0; i < len; i++){
sum += inputs[i]*weights[i];
}
if (sum > 0) return 1;
else return -1;
}
File main.cpp
#include <iostream>

using namespace std;

#include <Perceptron.h>

#define INPUTS_COUNT 3
int main()
{
Perceptron p = new Perceptron(INPUTS_COUNT);

return 0;
}

Error: By compiling in Code Blocks:

||=== Build: Debug in SimplePerceptron (compiler: GNU GCC Compiler) ===|
C:\SheelaJ\C++Proj\SimplePerceptron\main.cpp||In function 'int main()':|
C:\SheelaJ\C++Proj\SimplePerceptron\main.cpp|10|error: invalid conversion from 'Perceptron*' to 'int' [-fpermissive]|
include\Perceptron.h|8|error: initializing argument 1 of 'Perceptron::Perceptron(int)' [-fpermissive]|
||=== Build failed: 2 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|

What am I doing wrong?
Perceptron p = new Perceptron(INPUTS_COUNT);
should be:
Perceptron p(INPUTS_COUNT);
Topic archived. No new replies allowed.