Exception thrown: write access violation.
_Left was 0xCCCCCCCC.
If there is a handler for this exception, the program may be safely continued. What does this mean and how do i fix my code?
int main()
{
const int SIZE = 25;
int Nopeople = 0;
double salesAmount[SIZE];
string salesPersonName[SIZE];
int ctr=0;
ofstream fout("sales.fil");
if (!fout.is_open());
{
cout << "problem opening file." << endl;
system("pause");
exit(-1);
}
fout << fixed << setprecision(4);
//housekeeping
//input
cout << "Enter sales persons name:";
getline(cin, salesPersonName[SIZE]);
cout << "Enter sales amount:";
cin >> salesAmount[SIZE];
Nopeople++;
//processing
//output
fout << setw(15) << left << "Name"
<< setw(15) << right << "Sales Amount" << endl;
fout << setw(20) << left << salesPersonName;
fout << setw(20) << right << salesAmount;
fout << "Number of sales people" << Nopeople;
cout << "Program ended successfully" << endl;
system("type sales.fil");
system("pause");
}
Last edited on
thanks wildblue but now im getting this before it even opens in console
Exception thrown: write access violation.
_Left was 0xCCCCCCCC.
If there is a handler for this exception, the program may be safely continued.