I am trying to write a code that asks which division the user wants and then they are asked to enter the quarter number (1-4) and each quarter's sales. However I am having a hard time figuring out how to get my cout<< "Please enter" << c.DivisionName[t]<< "quarter number:" << endl; to actual recall the division they picked.
bool fQuit = false;
while(!fQuit)
{
cout<<"Please select: \n1.North \n.2South \n3.East \n4.West \n5.Quit \n";
int choice;
cin>>choice;
switch(choice)
{
case 1:
{
//here you can either accept data for one particular quarter for North or for all four quarters through a loop
//remember North is row [1] of the array, so any entry would be of the form QuarterItSales[1][j] where j indexes the quarter
break;
}//you'll need the braces within the case statements to scope the local variables that will be required for accepting data
...
...
...
case 5:
fQuit = true;
cout<<"You've decided to stop entering sales data \n";
break;
default:
cout<<"Invalid entry, try again \n";
break;
}
}
Couple of comments: (a) you open a file in your program that you neither read from nor write to, maybe there are other parts of your program not posted here, if not this should be removed, (b) it is safer to initialize your array elements to 0 upon declaration so that there is no garbage data in any of the cells that can corrupt your readings