本文整理汇总了C++中Stack::GetStackSize方法的典型用法代码示例。如果您正苦于以下问题:C++ Stack::GetStackSize方法的具体用法?C++ Stack::GetStackSize怎么用?C++ Stack::GetStackSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stack
的用法示例。
在下文中一共展示了Stack::GetStackSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
//Stack <double, 5> kExpStack;
Stack <double> kExpStack(5);
cout << "Stack Size = " << kExpStack.GetStackSize() << endl;
kExpStack.push(145.5f);
kExpStack.push(183.25f);
kExpStack.push(162.3f);
int Count = kExpStack.Count();
for ( int i = 0 ; i < Count; ++i )
{
cout << kExpStack.pop() << endl;
}
Stack <long> kStackMoney;
cout << "Stack Size = " << kStackMoney.GetStackSize() << endl;
kStackMoney.push(1000023);
kStackMoney.push(1000234);
kStackMoney.push(1000145);
Count = kStackMoney.Count();
for ( int i = 0 ; i < Count; ++i) {
cout << "money - " << kStackMoney.pop() << endl;
}
char GameID1[MAX_ID_LENGTH] = "Nice";
char GameID2[MAX_ID_LENGTH] = "Super";
Stack<char *> kStack2(64);
kStack2.push(GameID1);
kStack2.push(GameID2);
Count = kStack2.Count();
for ( int i = 0 ; i < Count; ++i) {
cout << "ID - " << kStack2.pop() << endl;
}
return 0;
}