我正在学习c ++,我的项目是关于队列的。
我有:
struct dough {
string code;
int stirringTime;
};
通常,在我的任务中,我们使用int
而不是struct
。这就是为什么我的删除功能有问题:
使用int:
int delQ(Queue &Q) // => return int
如果我这样做:
struct delQ(Queue &Q) // => what do i return?
我正在学习c ++,我的项目是关于队列的。
我有:
struct dough {
string code;
int stirringTime;
};
通常,在我的任务中,我们使用int
而不是struct
。这就是为什么我的删除功能有问题:
使用int:
int delQ(Queue &Q) // => return int
如果我这样做:
struct delQ(Queue &Q) // => what do i return?
您用struct
定义的类型不是struct
,而是dough
。
因此,如果您习惯使用int
,但想使用新结构,只需将int
替换为dough
:
dough delQ(Queue &Q) {
dough retval; // I don't know how you initialize your struct
....
return retval;
}