error C2064: term does not evaluate to a function taking 1 arguments

Try as I might, I need this code to work today! I keep getting the code I put for the title on this code and I have NO IDEA why! I had it set up as a for loop rather than the goto statement originally, but it was the only thing I thought I could tinker with. PLEASE HELP. This function is part of a much bigger function, so it might not seem like much. What I need the function to do is to take values and have a +4 sequence to them, and each of those return a value to the larger function. It will not be possible for this function to get any values less than 19.

Sequence = (n, n+4, n+8, n+12...)
Values I need
19 + sequence = return value 0;
20 + sequence = return value 5;
21 + sequence = return value 4;
22 + sequence = return value 2;

This code keeps getting the error, and I don't think it's taking on more than one argument. Please help if you can.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/*************************************
century function calculates what century a year is to apply it to the math in calendar function
*************************************/
int century(int gregorianyear)
{
	int temp;
	gregorianyear = gregorianyear/100;
	temp = gregorianyear;

top:
	if(temp==19)
		return 0;
	else if(temp==20)
		return 5;
	else if(temp==21)
		return 4;
	else if(temp==22)
		return 2;
	else
        {
		temp = temp - 4;
		goto top;
	}
}//century 
closed account (zwA4jE8b)
how are you calling the function?
I keep getting the code I put for the title on this code and I have NO IDEA why!

It's because the function takes only one argument - a single parameter - and you're trying to pass it some other number of parameters. he function you've shown us takes a single int. You're trying to pass it something else.
The only place I have that calls the function is this. Variable year is from cin.


total = century(year);
Figured it out, I had a variable int century laying in the larger function. Thanks for having me check into my larger function, when I was so set in trying to look at the smaller function. The code works. solved!
Topic archived. No new replies allowed.