Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Basically the problem is to : Have an array of struct\'s each containing 2 eleme

ID: 3626347 • Letter: B

Question

Basically the problem is to :
Have an array of struct's each containing 2 elements: char name[80] and int uid.

The data base will be constructed in main() and searched and displayed in a function named findData(). The database is to be passed by value to the function. Do not pass data by reference.

When the user inputs a name, it should search for a match and output the address. I know I need to use a dot operator but how exactly does it work, do I need to create address in struct and have employee.address in the main?
Please help, any guidance would be greatly appreciated.

#include <iostream>

#include <string>



using namespace std;



struct EmployeeSearch

{

char name[80];

int iud;

};



void findData(EmployeeSearch employee[]);




int main()

{

EmployeeSearch employee[8];



findData(employee);



return 0;

}

Explanation / Answer

#include <iostream>
#include <string>
using namespace std;
struct EmployeeSearch
{
char name[80];
int iud;
};
void findData(EmployeeSearch employee[],char st[])
{
for(int i=0; i<8; i++)
if(strcmp(employee[i]),st)==0) printf("match Found");

}
int main()
{
EmployeeSearch employee[8];
findData(employee,"myname");
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote