2

I am trying to write a function that returns a struct. I keep getting an error that says:

reference to overloaded function could not be resolved, Did you mean to call it?

Please help.

enter image description here

Code-Apprentice
  • 81,660
  • 23
  • 145
  • 268
Nicola Daaboul
  • 77
  • 2
  • 2
  • 6
  • 1
    The reasons for these errors are most likely missing `#include` lines. Please post a [Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve). – R Sahu Feb 15 '16 at 04:28
  • 3
    Please always add code as text, as opposed to code in an image. – Ahmed Akhtar Feb 15 '16 at 04:54

2 Answers2

1

cin >> endl is a mistake. endl is only for outputting.

To consume up to the end of the line after reading, you can use:

cin.ignore(numeric_limits<streamsize>::max(), '\n');

However for your program it is not necessary to do that. (Each >> reader you use consumes leading whitespace already). So for this program you could just take out the >> endl.

M.M
  • 138,810
  • 21
  • 208
  • 365
-3

for 'cin', there is no overloaded operator to get 'string' datatype, but you can call getline(cin, employee.name) where getline is defined in

chinlean
  • 25
  • 3
  • 2
    Have ever tried, what you are claiming. Your statement: _for `cin`, there is no overloaded function to get `string` datatype_ is completely wrong. Instead, `cin` cannot be used to take a `string` with spaces as input. – Ahmed Akhtar Feb 15 '16 at 04:57
  • Ya, I proably wrong as I haven't try out what I wrote..Anyway, you can check here http://stackoverflow.com/questions/18786575/using-getline-in-c – chinlean Feb 15 '16 at 05:04