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


C++ Skill::Display方法代码示例

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


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

示例1: TestSkillTree

void TestSkillTree()
{
	// Student skills 

	SkillTree student("Student");
	student.Display(cout);

	student.AddSkill("Alphabet","Mastery of letters and sounds",0);
	student.Display(cout);

	student.AddSkill("Reading","The ability to read all manner of written material",1,"Alphabet");
	student.AddSkill("Writing","The ability to put your thoughts on paper",1,"Alphabet");
	student.Display(cout);

	student.AddSkill("Speed Reading Level 1","Read any text twice as fast as normal",5,"Reading");
	student.AddSkill("Speed Reading Level 2","Read any text four times as fast as normal",10,"Speed Reading Level 1");
	student.AddSkill("Memorization","Memorize average sized texts",10,"Reading");
	student.AddSkill("Massive Memorization","Memorize large sized texts",20,"Memorization");
	student.AddSkill("Spell Writing","The ability to write spells",5,"Writing");
	student.AddSkill("History","The ability to write (and rewrite) history",10,"Writing");
	student.AddSkill("Written Creation","The ability to write things into reality",20,"History");
	student.Display(cout);

	// Warrior skills
	SkillTree warrior("Warrior");
	warrior.AddSkill("Basic Training","Basic training and conditioning",0);
	warrior.AddSkill("Hand To Hand","The fundamentals of hand to hand combat",3,"Basic Training");
	warrior.AddSkill("Grappling","Learn the most common wrestingling moves and holds",10,"Hand To Hand");
	warrior.AddSkill("Marial Arts","Learn devestating hand to hand techniques based on ancient eastern arts",10,"Hand To Hand");
	warrior.AddSkill("Weapons","The beginning skill for all weapons",5,"Basic Training");
	warrior.AddSkill("Sword","Fundamentals of sharp metal things",10,"Weapons");
	warrior.AddSkill("Staff","Fundamentals of hard wooden sticks",10,"Weapons");
	warrior.AddSkill("Bow","Fundamentals of using a bow and arrow",10,"Weapons");
	warrior.Display(cout);

	// Now try adding stuff that doesn't belong

	student.AddSkill("Spitballs","The clever art of making and projecting spitballs",20,"Bully");
	student.Display(cout);

	// Now try adding a new root

	warrior.AddSkill("Physical Conditioning","Training in strength, flexibility, agility, and balance",0);
	warrior.Display(cout);

	// Now try adding too many children
	warrior.AddSkill("Energy Weapons","The use of energy weapons such as lasers.",20,"Weapons");
	warrior.Display(cout);

	// Finally, looks up some skills
	Skill* sk;
	sk = student.FindSkill("Reading");
	if (sk != NULL) {
		cout << "Found the skill" << endl;
		sk->Display(cout);
		cout << endl;
	} else {
		cout << "Not found" << endl;
	}
}
开发者ID:CBrooks12,项目名称:260CppLab4,代码行数:60,代码来源:main.cpp


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