当前位置: 首页>>代码示例>>C++>>正文


C++ ItemType::IsEmpty方法代码示例

本文整理汇总了C++中ItemType::IsEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ ItemType::IsEmpty方法的具体用法?C++ ItemType::IsEmpty怎么用?C++ ItemType::IsEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ItemType的用法示例。


在下文中一共展示了ItemType::IsEmpty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main()
{
   ItemType testItem;
   ItemType copyItem(2);
   ItemType otherItem(3);

   c234node testNode;
   c234node copyNode(copyItem);

   c234Tree testTree;

   //cout << testNode;

   bool ok;

   PrintMessage ("ItemType::constructor", "default");
   cout << "Value in the item is " << testItem;

   PrintMessage ("ItemType::constructor", "item = 2");
   cout << "Value in the item is " << copyItem;

   ToContinue();

   PrintMessage ("ItemType::IsEmpty", "empty");
   PrintBool (testItem.IsEmpty());

   PrintMessage ("ItemType::IsEmpty", "non-empty");
   PrintBool (copyItem.IsEmpty());

   ToContinue();

   PrintMessage ("ItemType::EmptyIt", "empty");
   cout << "Before Empty item = " << testItem;
   testItem.EmptyIt();
   cout << endl << "Now is it empty?";
   PrintBool (testItem.IsEmpty());


   PrintMessage ("ItemType::EmptyIt", "non-empty");
   cout << "Before Empty item = " << copyItem;
   testItem.EmptyIt();
   cout << endl << "Now is it empty?";
   PrintBool (testItem.IsEmpty());

   ToContinue();


   PrintMessage ("ItemType::oper=", "any");
   cout << "Before '=' lhs item = " << copyItem << endl;
   cout << "Before '=' rhs item = " << otherItem << endl;
   copyItem = otherItem;
   cout << "After  '=' lhs item = " << copyItem << endl;

   ToContinue();

   testItem.setValue(3);
   copyItem.setValue(1);

   PrintMessage ("ItemType::oper==", "non-equal");
   cout << testItem << " = " << copyItem << endl;
   PrintBool(testItem == copyItem);

   copyItem.setValue(3);

   PrintMessage ("ItemType::oper==", "equal");
   cout << testItem << " = " << copyItem << endl;
   PrintBool(testItem == copyItem);

   ToContinue();

   PrintMessage ("ItemType::oper>", "non-greater than");
   cout << testItem << " > " << copyItem << endl;
   PrintBool(testItem > copyItem);

   copyItem.setValue(1);

   PrintMessage ("ItemType::oper>", "greater than");
   cout << testItem << " > " << copyItem << endl;
   PrintBool(testItem > copyItem);

   ToContinue();

   PrintMessage ("ItemType::oper<", "non-less than");
   cout << testItem << " < " << copyItem << endl;
   PrintBool(testItem < copyItem);

   copyItem.setValue(5);

   PrintMessage ("ItemType::oper<", "less than");
   cout << testItem << " < " << copyItem << endl;
   PrintBool(testItem < copyItem);

   ToContinue();

   PrintMessage ("c234node::constructor", "default");
   cout << "Node looks like " << testNode;

   PrintMessage ("c234node::constructor", "item = 5");
   cout << "Node looks like " << copyNode;

//.........这里部分代码省略.........
开发者ID:garrettsparks,项目名称:Classwork,代码行数:101,代码来源:testall.cpp


注:本文中的ItemType::IsEmpty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。