如何在 C++ 中声明一个向量,同时允许用户输入定义向量的名称?好的,在查看您的回复后,这里有更多详细信息;这是来自 VS08 C++ 控制台应用程序的错误消息 -
Error 2 error C2664: 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::get(_Elem *,std::streamsize)' : cannot convert parameter 1 from 'std::istream' to 'char *' e:\c++\project 5\project 5\project 5.cpp 58 project 5
这是代码:
void addRecord()
{
vector<char>recordName;
vector<inventory>recordNameUser;
cout << "Name the record you want to store it as\n";
cin.get(cin, recordName);
cout << "Enter the item description\n";
cin.get(cin, recordNameUser.itemDescription);
cout << "Enter the quanity on hand\n";
cin >> recordNameUser.quanityOnHand;
cout << "Enter the wholesale cost\n";
cin >> recordNameUser.wholesaleCost;
cout << "Enter the retail cost\n";
cin >> recordNameUser.retailCost;
cout << "Enter the date of the inventory (mm/dd/yyyy)\n";
cin >> recordNameUser.inventoryDate;
}