"Help" is not a thread title.
http://cboard.cprogramming.com/showthread.php?t=85954
http://cboard.cprogramming.com/showthread.php?t=85970
http://cboard.cprogramming.com/showthread.php?t=86104
Why are you #including code inside code?
Where is your struct actually declared, other than in your post?
As a single file, does this work?
Code:
#include <iostream>
using namespace std;
// This would go into empinfo.h
struct empinfo{
char name[21];
char name1[21];
int hours;
float payrate;
};
extern void getempdata(struct empinfo emp1[], int &count1,int MAX1);
// This would go into empinfo.cpp
void getempdata(struct empinfo emp1[], int &count1, int MAX)
{
char ans,ret;
count1 =0;
while (((ans=='Y')||(ans =='y'))&&(count1<MAX))
{
cout << "tnput last name:";
cin.getline (emp1[count1].name,21);
cout << "input first name:";
cin.getline (emp1[count1].name1,21);
cout << "input hours:";
cin >> emp1[count1].hours;
cout << "input payrate:";
cin >> emp1[count1].payrate;
count1++;
cout << "input another - Y or N:";
cin >> ans;
cin.get(ret);
}
return;
}
// This would go into main.cpp
int main()
{ const int MAX =25;
struct empinfo emps[MAX];
int count;
getempdata(emps,count,MAX);
return 0;
}
As 3 files, it would be like this
Code:
// This would go into empinfo.h
struct empinfo{
char name[21];
char name1[21];
int hours;
float payrate;
};
extern void getempdata(struct empinfo emp1[], int &count1,int MAX1);
Code:
#include <iostream>
#include "empinfo.h"
using namespace std;
// This would go into empinfo.cpp
void getempdata(struct empinfo emp1[], int &count1, int MAX)
{
char ans,ret;
count1 =0;
while (((ans=='Y')||(ans =='y'))&&(count1<MAX))
{
cout << "tnput last name:";
cin.getline (emp1[count1].name,21);
cout << "input first name:";
cin.getline (emp1[count1].name1,21);
cout << "input hours:";
cin >> emp1[count1].hours;
cout << "input payrate:";
cin >> emp1[count1].payrate;
count1++;
cout << "input another - Y or N:";
cin >> ans;
cin.get(ret);
}
return;
}
Code:
#include <iostream>
#include "empinfo.h"
using namespace std;
// This would go into main.cpp
int main()
{ const int MAX =25;
struct empinfo emps[MAX];
int count;
getempdata(emps,count,MAX);
return 0;
}
Your project should contain just main.cpp and empinfo.cpp