Why is The following code is giving me the following compiler-error: “Cannot find a match for eat()”?
#include <iostream.h>
#include <conio.h>
void spit(char in[255])
{
cout << in;
}
void spit (int in)
{
cout << in;
}
int eat(int in)
{
cout << "? ";
cin >> in;
return in;
}
char* eat(char in[255])
{
cout << "? ";
cin >> in;
return in;
}
int main()
{
clrscr();
int input;
input = eat(); // <---- over here
spit(input);
getch();
return 0;
}
You need to pass a parameter to eat
But why do have function eat/spit with
char [255]as parameters?You don’t use it