oopss i still have a problem!!.. What's wrong with my code?
main()
{
int a[4];
int b[4];
int counter,sum=0;
cout<<"JANUARY";
for(counter=0;counter<4;counter++)
{
cout<<"Numbers of Rainfall:";
cin>>a[counter];
}
for(counter=0;counter<4;counter++)
{
sum+=a[counter];
}
cout<<"The numbers of rainfall in the first month"<<sum<<endl;
cout<<FEBRUARY;
for(counter=0;counter<4;counter++)
{
cout<<"Numbers of Rainfall";
cin>>b[counter];
}
for(counter=0;counter<4;counter++)
{
sum+=b[counter];
}
cout<<"The numbers of rainfall in the second month"<<sum<<endl;
getch();
return 0;
}
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..