for this function i need help with the email part. I am trying to string compare domain with 3 different string possibilities (.com,.org,.edu).
void add(char firstName[][32],char number[][9],char email[][32],char lastName[][32],int count)
{
int i;
int length;
char domain[3];
cout << "enter their name\n";
cin >> firstName[count];
cin >> lastName[count];
cout << "enter their number\n";
cin >> number[count];
cout << "enter their email\n";
cin >> email[count];
length=strlen(email[count]);
if(length>=4)
{
for(i=0;i<4;i++)
{
domain[i]=email[count][length-(i+1)];
}
}
if (strcmp(domain,"moc.")!=0 || strcmp(domain,"gro.")!=0 || strcmp(domain,"ude.")!=0)
{
cout <<"invalid email";
}
}