>I wanted it to index whatever name was entered and use that id_number,age, and securitycode.
How about a map?
Code:
#include <iostream>
#include <string>
#include <map>
using namespace std;
struct datacore {
int id_number;
int age;
int securitycode;
};
int main()
{
string name;
datacore bob,charlie,george;
map<string,datacore> Map;
bob.id_number = 338;
bob.age = 27;
bob.securitycode=1229;
Map["bob"] = bob;
charlie.id_number = 890;
charlie.age = 39;
charlie.securitycode=8894;
Map["charlie"] = charlie;
george.id_number = 115;
george.age = 70;
george.securitycode = 1126;
Map["george"] = george;
cout<<"Enter an employee name to access information about them: ";
cin>>name;
cin.ignore(80, '\n');
if (Map.find(name) != Map.end())
{
cout<<Map[name].id_number<<"\n"<<Map[name].age<<"\n"<<Map[name].securitycode;
}
cin.get();
return 0;
}