I am attempting to complete a homework assignment and would like to make an array of data structure and initialise it with names. However, when I try to compile my code I get the following error:
**error C2440: '=' : cannot convert from 'const char [13]' to 'const char'**
I am including my code below. Please advise me what I might be doing wrong. Many thanks for your help.
#define STD_HOUR 40.0
#define OT_CONSTANT 1.5
#define SIZE 5
static const int ietrations = 5; //For Number of Records
void Init(void); //Function Prototype to Initilize
void Calculate(int); //Function Prototype to Calculate Wagets etc
void Display(void); //Function Prototype to Display Data
void GetHours(void); //Function Prototype to Get Hours
/////////////////////////////////////// Employee Structure ////////////////////////////////////////////////////
struct employee
{
const char name[20];
double clock;
double wage;
double hours_worked;
double over_time_hours;
double gross;
};
/////////////////////////////////////// Employee Structure Based Array ////////////////////////////////////////
employee data[SIZE];
using namespace std;
int main()
{
Init(); //Call Initlize function
GetHours(); //Input Hours
Display(); //Display the Results
getch(); //Hold screen
return 0;
}//Main Ends here
void Init()
{
data[0].name ="Connie Cobol";
data[1].name ="Mary Apl";
data[2].name ="Frank Fortran";
data[3].name ="Jeff Ada";
data[4].name = "Anton Pascal";
//data[].name = {"Connie Cobol","Mary Apl","Frank Fortran","Jeff Ada","Anton Pascal"};
data[0].clock =98401;
data[1].clock =526488;
data[2].clock =765349;
data[3].clock =34645;
data[4].clock =127615;
data[0].wage = 10.60;
data[1].wage = 9.75;
data[2].wage = 10.50;
data[3].wage = 12.25;
data[4].wage = 8.35;
}