开发者

No match for operator>>

it says there is a problem with this function. It should get input from the user for number of spools to be ordered and then output the input it recieved. (thinking of adding a confirmation dialog if there is time).

/********************************************/
// 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;
}


You have your arrows backwards in this line:

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

it should be:

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

And your return statement needs to return something:

return spoolnum;


Yes.. you need to use << with cout.

ostream has not operator overloaded for >> and hence the error that you see.


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

and your return statement should return spoolnum:

return spoolnum;


This line:

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

Should be:

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜