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
|