记录详情

Compile Error

/in/foo.cc:19:6: error: expected unqualified-id before 'int'
 Date(int m = 1, int d = 1, int y = 2000)
      ^~~
/in/foo.cc:19:6: error: expected ')' before 'int'
/in/foo.cc:34:46: error: invalid initialization of non-const reference of type 'Date&' from an rvalue of type 'Date'
  Employee(double s = 0.00, Date birthmonth = 0) :salary(s), birthDay(birthmonth) {};
                                              ^
/in/foo.cc:16:4: note:   initializing argument 1 of 'Date::Date(Date&)'
    Date(Date& c) :month(c.month), day(c.day), year(c.year) {};
    ^~~~
/in/foo.cc:15:2: note:   after user-defined conversion: Date::Date(int, int, int)
  Date(int =1, int=1, int=2000);;
  ^~~~
/in/foo.cc: In constructor 'Employee::Employee(double, Date)':
/in/foo.cc:31:9: warning: 'Employee::salary' will be initialized after [-Wreorder]
  double salary;
         ^~~~~~
/in/foo.cc:30:7: warning:   'Date Employee::birthDay' [-Wreorder]
  Date birthDay;
       ^~~~~~~~
/in/foo.cc:34:2: warning:   when initialized here [-Wreorder]
  Employee(double s = 0.00, Date birthmonth = 0) :salary(s), birthDay(birthmonth) {};
  ^~~~~~~~
/in/foo.cc: In copy constructor 'Employee::Employee(Employee&)':
/in/foo.cc:31:9: warning: 'Employee::salary' will be initialized after [-Wreorder]
  double salary;
         ^~~~~~
/in/foo.cc:30:7: warning:   'Date Employee::birthDay' [-Wreorder]
  Date birthDay;
       ^~~~~~~~
/in/foo.cc:35:2: warning:   when initialized here [-Wreorder]
  Employee(Employee&e) :salary(e.salary),birthDay(e.birthDay){};
  ^~~~~~~~
/in/foo.cc: In function 'int main()':
/in/foo.cc:53:15: error: expected primary-expression before ';' token
  for (int i = ; i < n; ++i)
               ^
/in/foo.cc:56:34: error: no matching function for call to 'Employee::Employee(Date&, double&)'
   emp.push_back(Employee(d, basep));
                                  ^
/in/foo.cc:35:2: note: candidate: Employee::Employee(Employee&)
  Employee(Employee&e) :salary(e.salary),birthDay(e.birthDay){};
  ^~~~~~~~
/in/foo.cc:35:2: note:   candidate expects 1 argument, 2 provided
/in/foo.cc:34:2: note: candidate: Employee::Employee(double, Date)
  Employee(double s = 0.00, Date birthmonth = 0) :salary(s), birthDay(birthmonth) {};
  ^~~~~~~~
/in/foo.cc:34:2: note:   no known conversion for argument 1 from 'Date' to 'double'
/in/foo.cc:58:15: error: expected primary-expression before ';' token
  for (int i = ; i < n; ++i)
               ^
/in/foo.cc:60:34: error: invalid use of non-static member function 'double Employee::getSalary(int)'
   cout << fixed<< setprecision(2)<<emp[i].getSalary;
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/in/foo.cc:39:8: note: declared here
 double Employee::getSalary(int m)
        ^~~~~~~~

信息

递交者
类型
递交
题目
P1007 12.12 Payroll System Modification
语言
C++
递交时间
2020-03-27 21:10:59
评测时间
2020-03-27 21:10:59
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes