Help in c++ Program begginer

Hi, I'm having a problem solving this program --> ""Consider a company with two stores in relation to which it is intended to record the sales of the first three months of the year. It is intended to obtain the store that has earned the most, the month that earned less and the total sales of the three months of the two stores.""

But Im have every time the same "error" when the store 1 earned most it shows that the store 0 earned most here you have the program..
-------------------------------
#include <iostream>
#include <string>
using namespace std;
int main()

{
int store_months[2][3];
int total_sales,month_min,month_max;
int store_sum[3], sold_more;
int l,m;



for (int l = 0; l < 2; l++){
for (int m = 0; m < 3; m++){

cout<<"Enter the sales of the month "<<m<<" the store "<<l<<": ";
cin>>store_months[l][m];
cout<<endl;



}
}
for (int l = 0; l < 2; l++){
for (int m = 0; m < 3; m++){

store_sum[l] += store_months[l][m];

if (store_sum[1] > store_sum[2]){
cout<<"Store 0 sell more"<<endl;

}

else {
cout<<"Store 1 sell more"<<endl;


}

if (store_sum[1] == store_sum[2]){

cout<<"Both stores sell the same"<<endl;

}
}
}

return 0;
}
------------------------
@Unknown1234

Remember, that the arrays START at 0, not 1. So, this line
1
2
if (store_sum[1] > store_sum[2]){
cout<<"Store 0 sell more"<<endl;

should read
1
2
if (store_sum[0] > store_sum[1]){
cout<<"Store 0 sell more"<<endl;


Plus, you're using an uninitialized array in store_sum, so it could be holding any value to start with. You could change int store_sum[3], sold_more; to
int store_sum[3] = {0}, sold_more; which puts 0 values into the array
@whitenite1

Thanks man, it works now...
its not everybody that takes their time to answer people with questions, once more thanks and sry for my english!
@Unknown1234

You're very welcome. Glad it's working.

I don't what your native language is, but I'm sure I would not be able to converse in it, as well as you have in English. There is nothing to be sorry about.
Topic archived. No new replies allowed.