| jxovi10 (10) | |
|
every time i try to run my program i keep getting an identification error for empInfo. i tried putting int empInfo; but it wont work can someone please help me out. thank you in advance for your help #include <stdlib.h> #include <iostream> using namespace std; class employee { private: int id, maxHours; float payRate; public: void setInfo (int pin, float pay, int hours) { empInfo[pin].id = pin; empInfo[pin].payRate = pay; empInfo[pin].maxHours = hours; } void viewInfo (int record) { cout << empInfo[record].id; cout << endl << empInfo[record].payRate; cout << endl << empInfo[record].maxHours; } }; int main ( ) { int pin, hours, record; float pay; employee empInfo[1000]; cout << "Enter employee 3 digit ID: "; cin >> pin; cout << "Enter employee pay rate: "; cin >> pay; cout << "Enter employee max hours: "; cin >> hours; empInfo[pin].setData(pin, pay, hours); cout << "Enter the employee ID# of the record you wish to view: " << endl; cin >> record; empInfo.viewDate(record); system("PAUSE"); return 0; } | |
|
|
|
| Zhuge (2871) | |
| empInfo is declared in main but random methods inside the employee class are trying to modify it. | |
|
|
|
| Filiprei (132) | |
| I go to the lounge to relax! | |
|
|
|
| Fredbill30 (100) | |
| You should put this in the beginner's fourm | |
|
|
|