操作员不匹配>>

No match for operator>>

本文关键字:gt 不匹配 操作员      更新时间:2023-10-16

它说这个函数有问题。它应该从用户那里获得要订购的线轴数量的输入,然后输出收到的输入。(考虑在有时间的情况下添加一个确认对话框(。

/********************************************/
// Name: inspools                            /
// Description: Ask for and get number of    /
// spools                                    /
// Parameters: N/A                           /
// Reture Value: spoolnum                    /
/********************************************/
int spoolnum()
{
  int spoolnum;
  cout << "Number of spools to be shipped: " << endl;
  cin >> spoolnum;
  cout >> spoolnum >> " spool(s) of wire will be shipped" >> endl;
  return;
}

您的箭头在这行向后:

cout >> spoolnum >> " spool(s) of wire will be shipped" >> endl;

应该是:

cout << spoolnum << " spool(s) of wire will be shipped" << endl;

您的return语句需要返回一些内容:

return spoolnum;

是。。您需要将<<cout一起使用。

ostream没有为>>重载运算符,因此您看到了错误。

cout << spoolnum << " spool(s) of wire will be shipped" << endl;

并且您的return语句应该返回spoolnum:

return spoolnum;

此行:

cout >> spoolnum >> " spool(s) of wire will be shipped" >> endl;

应为:

cout << spoolnum << " spool(s) of wire will be shipped" << endl;