![]() |
| ||
| arrays! a little help! oopss i still have a problem!!.. What's wrong with my code? main()now my aim is to add all the values of first month and then print it. and same as the second month.(add all the values of second month and then print it). And when i run the program and then i put a values in the first month and its working fine but my problem is in second month because after i put a values in second month, the output of 1st month will add to the values of second month. ex. JANUARY Numbers of Rainfall:4 Numbers of Rainfall:3 Numbers of Rainfall:2 Numbers of Rainfall:1 The numbers of rainfall in the first month 10 FEBRUARY Numbers of Rainfall:5 Numbers of Rainfall:4 Numbers of Rainfall:3 Numbers of Rainfall:2 The numbers of Rainfall in Second month 24 now i need help on the second month on how to print the second month without adding the first month..? Sorry i'm a newbie programmer but i'm studying hard. thanks guys.. |
| ||
| Re: arrays! a little help! make sum = 0 after you have calculated the sum of first month. |
| ||
| Re: arrays! a little help! You need int a[4] and int b[4] for every month, something like: int a[12][4]; int b[12][4]; |
| ||
| Re: arrays! a little help! Just put sum = 0;before starting to add the second month rainfalls. Please read this and make sure to use code tags when posting code from now on EDIT: sweeya was faster, sorry. |
| ||
| Re: arrays! a little help! thanks for helping guys! sorry for i don't use the code tags.. it won't be happen again.. |
| ||
| Re: arrays! a little help! Well as they already said reset sum to zero; next problem in month two would be, you forgot quotes "in cout, and I'm assuming the lack of int before main() is a copy-paste oversight. You could create a class that holds all of the months, extra info and functions that deal with them; if you've gotten that far in your studies, yet. |
| All times are GMT -4. The time now is 4:21 am. |
Forum system based on vBulletin Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
©2003 - 2010 DaniWeb® LLC