Hi, I am new here. I am also a first-year computer science student looking for some help with a very small C++ program.
This is a 3-file program, header file with declarations and 2 source files, one for definition and the other is the actual application file. I am attempting to write a non-member function.
In my header file, I have declared bool isLarger(int x, int y); outside of the class. In my application file, before the end of the program, I have written the following code:
[code=cpp]
bool isLarger(firstD ate.convert(), secondDate.conv ert())
{
if (firstDate.conv ert() > secondDate.conv ert())
{
cout << "The first date entered is the most recent. " << endl << endl;
return true;
}
else
{
cout << "The second date entered is the most recent. " << endl << endl;
return false;
}
}
[/code]
When compiling this, the only error message I receive is: "error C2448: 'isLarger' : function-style initializer appears to be a function definition".
I think that that is what I intended - a function definition. Is there something illegal about this code that I am just not seeing?
Thank you in advance for any help.
Michelle
This is a 3-file program, header file with declarations and 2 source files, one for definition and the other is the actual application file. I am attempting to write a non-member function.
In my header file, I have declared bool isLarger(int x, int y); outside of the class. In my application file, before the end of the program, I have written the following code:
[code=cpp]
bool isLarger(firstD ate.convert(), secondDate.conv ert())
{
if (firstDate.conv ert() > secondDate.conv ert())
{
cout << "The first date entered is the most recent. " << endl << endl;
return true;
}
else
{
cout << "The second date entered is the most recent. " << endl << endl;
return false;
}
}
[/code]
When compiling this, the only error message I receive is: "error C2448: 'isLarger' : function-style initializer appears to be a function definition".
I think that that is what I intended - a function definition. Is there something illegal about this code that I am just not seeing?
Thank you in advance for any help.
Michelle
Comment