Advertisement
Ahrramin

error: x was not declared in this scope.

Jan 13th, 2014
374
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.19 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int GenerateID()
  6. {
  7.     static int nextID = 0;
  8.     return nextID++;
  9. }
  10.  
  11. void PrintInformation(Employee EmployeeName)
  12. {
  13.     cout << EmployeeName << "'s ID is: " << EmployeeName.ID << endl;
  14.     cout << EmployeeName << "'s age is: " << EmployeeName.age << endl;
  15.     cout << EmployeeName << "'s wage is: " << EmployeeName.wage << endl;
  16. }
  17.  
  18. int main()
  19. {
  20.  
  21.     struct Employee
  22.     {
  23.         int ID;
  24.         int age;
  25.         float wage;
  26.     };
  27.  
  28.     Employee Dominic;
  29.     Employee Jeffrey;
  30.  
  31.     Dominic.ID = GenerateID();
  32.     Dominic.age = 22;
  33.     Dominic.wage = 7.10;
  34.  
  35.     Jeffrey.ID = GenerateID();
  36.     Jeffrey.age = 28;
  37.     Jeffrey.wage = 7.10;
  38.  
  39.     PrintInformation(Dominic);
  40.     PrintInformation(Jeffrey);
  41.  
  42.     return 0;
  43. }
  44.  
  45. /*
  46. C:\CBProjects\Practise\main.cpp|11|error: variable or field 'PrintInformation' declared void|
  47. C:\CBProjects\Practise\main.cpp|11|error: 'Employee' was not declared in this scope|
  48. C:\CBProjects\Practise\main.cpp||In function 'int main()':|
  49. C:\CBProjects\Practise\main.cpp|39|error: 'PrintInformation' was not declared in this scope|
  50. ||=== Build finished: 3 errors, 0 warnings (0 minutes, 0 seconds) ===|
  51. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement