Click here to Skip to main content
15,889,266 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
how i can find annual rainfall? with arrays in c

What I have tried:

Can someone please explain for me how I should to do this?
Posted
Updated 10-Dec-22 5:21am
v2

1 solution

For a start you will need an array large enough for 53 years, 1970 - 2022, rather than 100. When you get the data use the year after subtracting 1970 as the index to your array, something like:
C++
void SetRainFall(int year, int amount)
{
    year -= 1970;
    annual_rainfalls[year] = amount;
}
 
Share this answer
 
Comments
Richard MacCutchan 10-Dec-22 10:34am    
Well the code above will still work; did you bother to try it?
Member 15858418 10-Dec-22 11:25am    
Yes, thanks a lot

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900