OK. I just don't understand what is the problem here. Here's the code

.h file :

#ifndef NVECTOR_H
#define NVECTOR_H


class Nvector
{
    public:

        //Nvector();
        Nvector(int Size = 0);
        void addElement(int a, int index);
        void getElement(int index);
        void push_me_back(int a);
        void push_me_front(int a);

    private:
        int *p_array;
        int velicina;
        int *resize_array(int *p_val, int curr_size);
        int *set_at_begin
        int curr_index;

};

#endif // NVECTOR_H

impl file :

#include "Nvector.h"
#include <iostream>

using namespace std;

Nvector::Nvector(int Size) : velicina(Size);

 {}  // korisnik odredjuje velicinu vektora

 void Nvector::addElement(int a,int index) {

  if(index => velicina){    // obrati paznju prilikom compajliranja

      p_array = resize_array(p_array, velicina)
  }

    p_array[index] = a;
    curr_index = index;

}

 void Nvector::getElement(int index) {

    return p_array[index];

 }

 int * Nvector::resize_array(int *p_old_array, int curr_size){

     int *p_new_array = new int[curr_size*2];

     for(int i = 0;i < curr_size;i++){

        p_new_array[i] = p_old_array[i];

    }

      delete [] p_old_array;
      return p_new_array;

 }

main file :

#include <iostream>
#include "Nvector.h"

using namespace std;

int main()
{

    Nvector Vector(10);
    Vector.addElement(3,0);

    cout << Vector.getElement(0);

}

Error message is the tittle of the post on the line 9 in main file (Nvector Vector(10)). Please help, am dying in here

Line 6 in you .cpp is Nvector::Nvector(int Size) : velicina(Size); it should be Nvector::Nvector(int Size) : velicina(Size)

.h file

Missing semi-colon at end of line 20

impl file

Remove semi-colon from end of line 6
Operator is wrong on line 12 (>=)
Missing semi-colon on line 14
Does the function getElement return something or not? If it does, its return type should not be void. If it doesn't, remove the return.

all fixed, and yet the original error message is still there. I just dont get it, is it so hard to init a member of a class with constructor

Post the code that you have now.

.h :

#ifndef NVECTOR_H
#define NVECTOR_H


class Nvector
{
    public:

        Nvector();
        Nvector(int Size);

        void addElement(int a, int index);
        int getElement(int index);
        void push_me_back(int a);
        void push_me_front(int a);

    private:
        int *p_array;
        int velicina;
        int *resize_array(int *p_val, int curr_size);
        int *set_at_begin;
        int curr_index;

};

#endif // NVECTOR_H

.cpp :

#include "Nvector.h"
#include <iostream>

using namespace std;

Nvector::Nvector(int Size){

   velicina = Size;

}

Nvector::Nvector() {

   velicina = 0;

} // korisnik odredjuje velicinu vektora

 void Nvector::addElement(int a,int index) {

  if(index >= velicina){    // obrati paznju prilikom compajliranja

      p_array = resize_array(p_array, velicina);
  }

    p_array[index] = a;
    curr_index = index;

}

 int Nvector::getElement(int index) {

    return p_array[index];

 }

 int * Nvector::resize_array(int *p_old_array, int curr_size){

     int *p_new_array = new int[curr_size*2];

     for(int i = 0;i < curr_size;i++){

        p_new_array[i] = p_old_array[i];

    }

      delete [] p_old_array;
      return p_new_array;

 }

 void Nvector::push_me_back(int a){

    addElement(a,curr_index+1);

 }

 void Nvector::push_me_front(int a){

      p_array = set_at_beign(a);

 }

 int *Nvector::set_at_beign(int a){

     int p_copy_array = new int[velicina+i];
     p_copy_array[0] = a;

     for(int i = 1;i< velicina+1;i++){   // proverit ovaj code poslije comp

        p_copy_array[i] = p_array[i];

        }

        delete [] p_array;
        return p_copy_array;

 }

main :

#include <iostream>
#include "Nvector.h"

using namespace std;

int main()
{

    Nvector Vector(10);
    Vector.addElement(3,0);

    cout << Vector.getElement(0);

}

I read that I should include def constr but same error message.

When I made the changes that I listed, and got this:

#include <iostream>
using namespace std;

class Nvector
{
    public:
        //Nvector();
        Nvector(int Size = 0);
        void addElement(int a, int index);
        int getElement(int index);
        void push_me_back(int a);
        void push_me_front(int a);
    private:
        int *p_array;
        int velicina;
        int *resize_array(int *p_val, int curr_size);
        int *set_at_begin;
        int curr_index;
};

Nvector::Nvector(int Size) : velicina(Size)
 {}  // korisnik odredjuje velicinu vektora
 void Nvector::addElement(int a,int index) {
  if(index >= velicina){    // obrati paznju prilikom compajliranja
      p_array = resize_array(p_array, velicina);
  }
    p_array[index] = a;
    curr_index = index;
}
 int Nvector::getElement(int index) {
    return p_array[index];
 }
 int * Nvector::resize_array(int *p_old_array, int curr_size){
     int *p_new_array = new int[curr_size*2];
     for(int i = 0;i < curr_size;i++){
        p_new_array[i] = p_old_array[i];
    }
      delete [] p_old_array;
      return p_new_array;
 }


int main()
{
    Nvector Vector(10);
    Vector.addElement(3,0);
    cout << Vector.getElement(0);
}

it compiled fine (although it will crash when you run it). What are you using to compile it?

GNU GCC comp, I know it has a lot of mistakes, but couldn't focus on it cause of this error

That compiler should be fine, and given that the code I posted above compiles fine, I can only think that you must have missed one of the errors we pointed out to you.

and what did you change except not spliting into more files which is not the point?

and what did you change

Can you see the third post in this thread?

There are further things that are immediately noticeable in the last code you posted.
Check your spelling on lines 59 and 63 - set_at_beign should be set_at_begin

it works now, thanks everybody

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.