C++ Entering Multiple Values into Element of 2D Array -


my question regarding entering information elements of array. have created [2][3] array , attempting add age, id, , salary each element of array. bottom of code tried setting values in first element of array , underlines "employeearray" , says expression must have value type. setting values correctly wondering if missing of initialization, pointer, etc somewhere else in code. attached complete code below

class employee {   private:   int age;   int id;   float salary;   public:   employee() {     age = 0;     id = 0;     salary = 0; }  void setage(int x) {     age = x; } void setid(int x) {     id = x; } void setsalary(float x) {     salary = x; } int getage(); int getid();            float getsalary();  };  int employee::getage() {   return age; } int employee::getid() {    return id; }    float employee::getsalary() {    return salary; }    int main() {    const int rows = 2; const int columns = 3;  int employeearray[rows][columns]; employeearray[0][1].setage(30); employeearray[0][1].setid(111); employeearray[0][1].setsalary(30000); 

when declare multidimensional array declaring array of ints. this:

int employeearray[rows][columns]; 

should more like:

employee employeearray[rows][columns]; 

ints not respond .setage , other functions not part of types class.

cheers


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -