#include <iostream>
using namespace std;
string itmCndtn,itemName;
int strtPrice,sellValue,numRelist,optn=0;
class CBAY_ITEM
{
string enterName();
string enterCondition();
int enterStrtPrc();
int enterSellVal();
};
CBAY_ITEM infoClass;
CBAY_ITEM *nPointer=NULL;
int main()
{
int optionChosen=0;
int strtPrcTemp=0,sellValueTemp=0;
do
{
cout << "\nPlease Enter a Choice From the Menu.\n"<<endl;
cout << "\n1.Add an Item to Selling Queue.\n2.Put Item for Sale.\n3.Show Me the Money.\n4.Exit." << endl;
cin>>optionChosen;
switch(optionChosen)
{
case 1:
{
nPointer=new CBAY_ITEM;
nPointer->enterName()=infoClass.enterName();
nPointer->enterCondition()=infoClass.enterCondition();
nPointer->enterStrtPrc()=infoClass.enterStrtPrc();
nPointer->enterSellVal()=infoClass.enterSellVal();
}
case 2:
{
}
case 3:
{
}
}
}while(optionChosen!=4);
return 0;
}
これはこれまでの私のコードです。クラス内の関数の定義は省略しました。問題がそこにあるようには見えないからです。コンパイルしようとすると、コンパイラに次のエラーが表示されます
lvalue required as left operand of assignment.
何を言おうとしているのかわからない。
nPointer->enterStrtPrc()=infoClass.enterStrtPrc();
nPointer->enterSellVal()=infoClass.enterSellVal();
int 値を返し、動的に作成されたクラスに格納することになっていますinfoClass
。