C++ C2280运行程序时出错

C++ C2280运行程序时出错,c++,C++,我在运行程序后遇到了错误c2280,我无法确定问题出在哪里。有人能就这个问题给我提建议吗? 交易记录.h #ifndef交易记录 #定义事务 #include <iostream> #include <string> #include <sstream> #include <cstring> using namespace std; class Transaction { public: Transaction(string inpu

我在运行程序后遇到了错误c2280,我无法确定问题出在哪里。有人能就这个问题给我提建议吗? 交易记录.h #ifndef交易记录 #定义事务

#include <iostream>
#include <string>
#include <sstream>
#include <cstring>


using namespace std;

class Transaction
{
public:
    Transaction(string input);
    string getDate();
    string getTime();
    string getCondition();
    float getPrice();
    float getValue();
    int getVolume();
    void find_and_replace(string& source, string const& find, string const& replace);

private:
    ostringstream date;
    ostringstream time;
    string condition;
    float price, value;
    int volume, day, month, year, hour, minute;
};

Transaction::Transaction(string input) {

    find_and_replace(input, "/", " ");
    find_and_replace(input, ":", " ");
    find_and_replace(input, "", " ");
    stringstream tranStream(input);
    tranStream >> day;
    tranStream >> month;
    tranStream >> year;
    tranStream >> hour;
    tranStream >> minute;
    tranStream >> price;
    tranStream >> volume;
    tranStream >> value;
    tranStream >> condition;

}

string Transaction::getDate() {
    date << day << '/' << month << '/' << year;

    return date.str();
}

string Transaction::getTime() {
    string PlusZero;
    if (minute < 10) {
        PlusZero = "" + to_string(minute);
        time << hour << ':' << PlusZero;
    }
    else {

        time << hour << ':' << minute;
    }
    return time.str();
}

float Transaction::getPrice() {
    return price;
}

int Transaction::getVolume() {
    return volume;
 }

float Transaction::getValue() {
    return value;
}

string Transaction::getCondition() {
    return condition;

}

void Transaction::find_and_replace(string& source, string const& find, string const& replace)
{
    for (string::size_type i = 0; (i = source.find(find, i)) != string::npos;)
    {
        source.replace(i, find.length(), replace);
        i += replace.length();
    }
}

#endif // !TRANSACTION_H

mainmenu.cpp
#include <iostream>
#include <string>
#include <fstream>
#include <vector>
#include "Transaction.h"

using namespace std;

void printStock(vector<Transaction> t, int i) {
    cout << "Date :" << t.at(i).getDate << endl;
    cout << "Time :" << t.at(i).getTime() << endl;
    cout << "Price : " << t.at(i).getPrice() << endl;
    cout << "Volume : " << t.at(i).getVolume() << endl;
    cout << "Value : " << t.at(i).getValue() << endl;
    cout << "Condition: " << t.at(i).getCondition() << endl;
    cout << endl;
}


int main() {
    string menu;

    vector<Transaction> TransList;
    string a = "24/07/2015 17:00,6,67889,407334,CT";
    string b = "24/07/2015 17:01,5.8,144,835.2,XT";
    string c = "24/07/2015 17:04,0,0,0,CTXT";
    string d = "24/07/2015 17:10,5.78,1203,6953.34,CT";

    TransList.push_back(a);
    TransList.push_back(b);
    TransList.push_back(c);
    TransList.push_back(d);



    for (int i = 0; i < TransList.size(); i++) {
    printStock(TransList, i);
    }

    cin >> menu;
    return 0;
}
#包括
#包括
#包括
#包括
使用名称空间std;
类事务
{
公众:
事务(字符串输入);
字符串getDate();
字符串getTime();
字符串getCondition();
浮动价格();
float getValue();
int getVolume();
无效查找和替换(字符串和源、字符串常量和查找、字符串常量和替换);
私人:
ostringstream日期;
ostringstream时间;
字符串条件;
浮动价格、价值;
整数卷,日,月,年,小时,分钟;
};
事务::事务(字符串输入){
查找和替换(输入“/”,“”);
查找和替换(输入“:”,”);
查找和替换(输入“,”);
stringstream tranStream(输入);
跨流>>日;
跨流>>月;
跨流>>年;
跨流>>小时;
跨流>>分钟;
跨流>>价格;
横流>>体积;
跨流>>值;
跨流>>条件;
}
字符串事务::getDate(){

日期不允许复制
ostringstream
,并且您的类有两次内部,因此如果没有自己的复制构造函数,您无法复制此类。但是,您可以更改:
void printStock(向量t,int i){
void printStock(向量&t,int i){
并通过引用而不是复制来传递向量

可以考虑使用<代码> EpStudioBuffe/Cuth>而不是<代码> PuthyBuff直接在向量内构造事务。使用PuxyBead创建临时对象,然后使用移动构造函数将其添加到vector中。

另一个错误是:
cout Hi KIIV,谢谢你的帮助!我尝试更改ostringstream并传递向量引用,现在没有发现错误!