1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
cout << endl;
cin.ignore(1);
cout << "Enter Name of pen: "; getline(cin, description); cout << description;
cin.clear();
cout << "Enter stock number: "; cin >> stockNumber;
cout << "Enter quantity: "; cin >> quantity;
cout << "Enter price: "; cin >> price;
cout << "Enter pen color (1,2,3): "; cin >> nPenColor;
cout << "Enter ink color (1,2,3): "; cin >> nInkColor;
supplyList[3] = new Pen(description, stockNumber, quantity, price, nPenColor, nInkColor );
//store pointer to MemPen obect mp1 in [2]
//
cout << description;
cout << endl;
description = " ";
cout << "Test" << endl;
cout << des2;
cout << "Enter Name of pen: "; getline(cin,description); //Error occurs here
cout << description;
cin.ignore(1000,'\n');
cout << "Enter stock number: "; cin >> stockNumber;
cout << "Enter quantity: "; cin >> quantity;
cout << "Enter price: "; cin >> price;
cout << "Enter pen color (1,2,3): "; cin >> nPenColor;
cout << "Enter ink color (1,2,3): "; cin >> nInkColor;
cout << "Enter memory size in Mb: "; cin >> memory;
//
//loop to print out ALL elements in the array that point to an object,
//that is, there is a valid address in the element of the array.
supplyList[7] = new MemPen( des2, stockNumber, quantity, price, nPenColor, nInkColor, memory);
|