0
#include <iostream>  // stream
#include <cmath>  // math functions
#include <cctype>  // toupper
using namespace std;
int main()
{
 int jul1;
 int jul2;
 int diff;
 int jdate;
 int toupper;
 char ans = 'Y';
 
 do
 {
 jul1 = jdate(); /* Term does not evaluate to a function */
 jul2 = jdate(); /* Term does not evaluate to a function */
 diff = jul1-jul2;
 cout << "# of days between the two dates: " << diff;
 
 cout << "Again?(Y/N): ";
 
 ans = toupper( cin.get() ); /* Term does not evaluate to a function */
 } while ( ans == 'Y');
}

int jdate(int jul1, int jul2 )
{
 int day,month,year,year1,leapyear,regyear;
 int DayInMonth[] = {0,31,28,31,30,31,30,31,31,30,31,30,31};
 int DaysInYear[] = {0,0,31,59,90,120,151,181,212,243,273,304,334,365};
 int DaysInLeapYear[] = {0,0,31,60,91,121,152,182,213,244,274,305,335,366};
 do
 {
  cout << "Year: ";
  cin >> year;
 } while (year < 1900 || year > 2099);
 do 
 {
  cout << "Month: ";
  cin >> month;
 } while (month < 1 || month > 12);
 do
 {
  cout << "Day: ";
  cin >> day;
 } while (day < 1 || day > 31);
 DaysInLeapYear[month]; 
 DaysInYear[month]; 
 
 if ( year % 4 == 0 && year1 == 0)
  jdate = year * 365 + (year-1)/4 + DaysInLeapYear[month] + day; /* '='overloaded function as left operand */
                                                               
 else
  jdate = year * 365 + (year-1)/4 + DaysInYear[month] + day; /* '='overloaded function as left operand */
  return 0;
}

I don't understand why i am getting the

"term does not evaluate to a function" error on the line:
jul1 = jdate();
and
jul2 = jdate();

2
Contributors
1
Reply
2
Views
10 Years
Discussion Span
Last Post by John A
0

> "term does not evaluate to a function" error on the line:
Perhaps that's because you've given a variable identical names to a function?

And you should consider using function prototypes, and giving arguments to the function when you call it (it does take 2 of them, remember).

[edit]

Just return the values back from the function, don't assign them to the non-existant 'jdate' variable.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.