i get this strange error while ruining my program with Visual C++ 2008 Express Edition:
'Ex2.exe': Loaded 'D:\studyMA\c++\visual studio\Ex2\Ex2\Debug\Ex2.exe', Symbols loaded.
'Ex2.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll'
'Ex2.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll'
'Ex2.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.VC90.DebugCRT_1fc8b3b9a1e18e3b_9.0.30729.1_x-ww_f863c71f\msvcp90d.dll'
'Ex2.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.VC90.DebugCRT_1fc8b3b9a1e18e3b_9.0.30729.1_x-ww_f863c71f\msvcr90d.dll'
First-chance exception at 0x1049615e in Ex2.exe: 0xC0000005:
Access violation reading location 0x333ee91c.
Unhandled exception at 0x1049615e in Ex2.exe: 0xC0000005:
Access violation reading location 0x333ee91c.
The program '[948] Ex2.exe: Native' has exited with code 0 (0x0).
class product
looks like this:
using namespace std;
class product
{
public:
string Product_code;
string Product_Name;
string Product_Category;
string Product_Vendor;
string Product_Discription;
string Product_Group;
void input();
void clear_product_cell();
};
I have one more class (contained in bomba.h) which contains:
product ProductList[100];
I've written code in bomba.cpp, asking the user for input:
char ch;
cout << "Please Select your option: ";
cin >> ch;
switch(ch)
{
case '1'://Add a product
{
ProductList[0].input();
:
:
:
product.cpp looks like this:
product::input()
do{
cout << "Please enter product code: ";
getline(cin,Product_code);
if (Product_code.empty())
cout << "You Must Enter A Code!!!";
} while(Product_code.empty());
cout << endl;
In the console, I get:
Please Select your option: 1 Please enter product code:
...and when I type a number and after the number I type the CR key the program crashes and I get the errors I quoted above.