Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int GenerateID()
- {
- static int nextID = 0;
- return nextID++;
- }
- void PrintInformation(Employee EmployeeName)
- {
- cout << EmployeeName << "'s ID is: " << EmployeeName.ID << endl;
- cout << EmployeeName << "'s age is: " << EmployeeName.age << endl;
- cout << EmployeeName << "'s wage is: " << EmployeeName.wage << endl;
- }
- int main()
- {
- struct Employee
- {
- int ID;
- int age;
- float wage;
- };
- Employee Dominic;
- Employee Jeffrey;
- Dominic.ID = GenerateID();
- Dominic.age = 22;
- Dominic.wage = 7.10;
- Jeffrey.ID = GenerateID();
- Jeffrey.age = 28;
- Jeffrey.wage = 7.10;
- PrintInformation(Dominic);
- PrintInformation(Jeffrey);
- return 0;
- }
- /*
- C:\CBProjects\Practise\main.cpp|11|error: variable or field 'PrintInformation' declared void|
- C:\CBProjects\Practise\main.cpp|11|error: 'Employee' was not declared in this scope|
- C:\CBProjects\Practise\main.cpp||In function 'int main()':|
- C:\CBProjects\Practise\main.cpp|39|error: 'PrintInformation' was not declared in this scope|
- ||=== Build finished: 3 errors, 0 warnings (0 minutes, 0 seconds) ===|
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement