I have started this program and have finished the first part and it builds just fine but when i debug it I am gettin an error message Run-time check failure#3 - the variable total_sales is being used without being defined. Can some help me out?

#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;


}


}

}

I have no idea what that is, except that it does not belong in the virus, spyware and nasties forum.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.