I have started this program and it builds fine but when I debug it
I get a run-time check error #3, the variable total_sales is being
used without being defined. Can some one help me out with this?
#include <iostream>
using namespace std;
void main()
{
int sp[10][7] = {89, 92, 87, 85, 95, 81, 90,
78, 81, 87, 77, 80, 88, 84,
88, 89, 91, 84, 97, 80, 88,
61, 62, 73, 75, 55, 73, 69,
95,100, 99,100, 95, 97, 98 };
int choice,sales_anyd,tot_store_sales,sp_number,
sales_person,total_sales,sp_num,avg,s;
cout << "1 - Average sales for a salesperson ";
cout << "2 - Total sales for any day ";
cout << "3 - Total sales by store for the week ";
cout << "4 - Print the sales by salesperson ";
cout << "0 - Exit ";
cout << "Enter your choice: ";
cin >> choice;
{
switch (choice)
{
case (1):
cout << "Enter a sales person number :";
cin >> sp_num;
cout << "Enter a total sales any day :";
cin >> sales_anyd;
for (s = 0; s <= 9; s++)
{
total_sales = sales_anyd * total_sales[sp][s];
}
cout << "sales person total sales " << total_sales << " for "
<< "sales person " << sales_person << endl;
break;
}
}
}