Okay, I've got this structure, and once the user enters a few employees I'd like to show them all the employees that meet some criteria ( gender and payrate ).
But . . it's got two problems. The first is that i doesn't display the employees it's supposed to unless there's only one such person and they're entered last. The second is that the string that's supposed to hold the name isn't acting like a string, it's taking the first part of the name as the name and the last name as their gender ( the next input ). . . if you follow.
Here, I'll show you :
}; employee emp;
while( ans !='n' )
cout << "\n\n Please enter your employe information.\n\n";
cout << "Name: ";
cin >> emp[e].name;
cout << "Gender: ( F or M ) ";
cin >> emp[e].gender;
cout << "Age: ";
cin >> emp[e].age;
cout << "Social Security Number: ";
cin >> emp[e].ssn;
cout << "Payrate: ";
cin >> emp[e].payrate;
cout << "Would you like to add an employee ? Y/N ?";
cin >> ans;
for( ans=='n'; e>=0; e++ )
if ( emp[e].gender='f', emp[e].payrate<10 )
cout << emp[e].name;
cout << "No females with payrate less than 10$ an hour. :) \n";
So, why does it only display the person if they're entered last, and why doesn't the string that holds the name accept the space between the first and second part of the employees name as part of the name ?