I need to know what's wrong with the employee1.name & employee2.name in this program code, I receive the following error:
'=': left operand must b |-value
Code:
#include <iostream.h>
#include <string.h>
struct database
{
char name[6];
int id;
int age;
float salary;
};
int main()
{
//the database
database employee1;
employee1.name="Amira";
employee1.id=1;
employee1.age=16;
employee1.salary=12000;
database employee2;
employee2.name="Erica";
employee2.id=2;
employee2.age=15;
employee2.salary=10005;
//the program code
cout<<"Please write the employee ID to know more information about: ";
int input;
cin>>input;
cout<<endl<<" "<<endl;
switch (input)
{
case 1: cout<<"Name: "<<employee1.name<<endl;
cout<<"ID: "<<employee1.id<<endl;
cout<<"Age: "<<employee1.age<<endl;
cout<<"Salary: "<<employee1.salary<<endl;
break;
case 2: cout<<"Name: "<<employee2.name<<endl;
cout<<"ID: "<<employee2.id<<endl;
cout<<"Age: "<<employee2.age<<endl;
cout<<"Salary: "<<employee2.salary<<endl;
break;
default: cout<<"Error, bad input"<<endl<<" "<<endl;
}
//the next code is for ending the program
cout<<" "<<endl;
cout<<"Press T letter then Enter to terminate the program"<<endl;
char string;
cin>>string;
if(string=='t')
{
return 0;
}
else
{
cout<<"Error, bad input.";
main();
}
return 0;
}