Hi i am very new to C++ could someone please take a look at this code and tell me what I am doing wrong I am a total noob, so if you are willing to help please be as specific as possible. Thank you in advance for any comments.
[code
struct info
{
char last1 [25];
char first1 [25];
double payrate;
int hours;
};
[/code]
Code:#include <iostream> #include <iomanip> #include <fstream> #include <c:\Documents and Settings\Pat\Desktop\prog15\struct15.cpp\struct15.cpp\struct15.cpp> void getdata(char last1[25], char first1[25], int count, double payrate[25]); using namespace std; int main () { const int MAX = 25; struct info employee[MAX]; int count = 5; char (ret); char last[25]; char first[25]; double payrate[25]; getdata(last,first,count,payrate); return 0; } #include <c:\Documents and Settings\Pat\Desktop\prog15\getdata15.cpp\getdata15.cpp\get15.cpp>error codes below:Code:void getdata(char last1[25], char first1[25], double count, double payrate[25]) { char (ret); for (int i=0; i<=count; i++) { cout << "input Last Name:"<< endl; cin.getline >> (employee[i].last1,25); cout << "Input First Name:" << endl; cin.getline (employee[i].first1,25); cout << "Input payrate:" << endl; cin >> employee[i].payrate; cout << "Input Hours Worked:" << endl; cin >> employee[i].hours; cin.get (ret); return; } return; }
c:\documents and settings\pat\desktop\prog15\prog15.cpp\prog15.cpp\ main15.cpp(33) : error C2143: syntax error : missing ';' before 'return'
1>c:\documents and settings\pat\desktop\prog15\getdata15.cpp\getdata1 5.cpp\get15.cpp(11) : error C2065: 'employee' : undeclared identifier
1>c:\documents and settings\pat\desktop\prog15\getdata15.cpp\getdata1 5.cpp\get15.cpp(11) : error C2228: left of '.last1' must have class/struct/union
1>c:\documents and settings\pat\desktop\prog15\getdata15.cpp\getdata1 5.cpp\get15.cpp(13) : error C2228: left of '.first1' must have class/struct/union
1>c:\documents and settings\pat\desktop\prog15\getdata15.cpp\getdata1 5.cpp\get15.cpp(15) : error C2228: left of '.payrate' must have class/struct/union
1>c:\documents and settings\pat\desktop\prog15\getdata15.cpp\getdata1 5.cpp\get15.cpp(17) : error C2228: left of '.hours' must have class/struct/union



LinkBack URL
About LinkBacks


