I am having difficulty with nested loops. I am attempting to create a program that has the user enter monthly data during the course of a three year period. here is what I have so far.
#include <iostream>
const int Months = 12;
const int Years = 3;
int main()
{
using namespace std;
const char * months[Months]=
{"Jan", "Feb", "Mar", "Apr", "May", "June", "July", "Aug", "Sept", "Oct", "Nov", "Dec"}
int i = 0;
int j = 0;
int temp = 0;
int sales[Years][Months];
cout << "Enter the sales data for each month during 2005-2007.\n";
for (i; i < 12; i++)
{cout << months[i] << ":\t";
for (j; j < Years; j++)
{cin >> sales[j];}
}
return 0;
}
The problem that is occurring is that the user will be able to enter data for Jan, but after that it won't continue and allow the user to input data for the rest of the months. If anyone can add any insight into this it would be greatly appreciated.