⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.cc

📁 this is a lp0 compilator new
💻 CC
字号:
/******** stakdemo.cc **************************************************   Gerald Carter   cse 525   Spring 1994   stakdemo.cc    DESCRIPTION : This pprogram test the abstract stack class delclared in                 stack.h.  The process creates an integer stack, a string                  stack and a date class.  Each stack is tested individually                 with methods applied.***********************************************************************/// INCLUDE FILES#include <iostream.h>           // I/O streams#include <stdlib.h>             // rand()#include "stack.h"              // stack template declaration#include "stringcl.h"           // string class declaration#include "date.h"               // date class declaration// GLOBAL VARIABLESextern stack<int>       integer_stack;extern stack<string>    string_stack;extern stack<date>      date_stack;/*---------------------------------------------------------------------                               MAIN DRIVER---------------------------------------------------------------------*/int main (void){   // local variables used   int                     i = 0;   int                     popped_int;   string                  popped_str;   // ----- INTEGER STACK   cout << "Entering the integer stack segment of the program...\n";   for (; i<10; ++i) integer_stack.Push(rand());   cout << "Here is the integer stack :\n";   integer_stack.Print();   popped_int = integer_stack.Pop();   cout << "Here is the integer stack after popping the top...\n";   integer_stack.Print();   cout << "   ...and here is the popped top : " << popped_int << "\n";   integer_stack.Dump();   cout << "Here is the integer stack after being dumped...\n";   if (integer_stack.IsEmpty())      cout << "    Sorry.  There is nothing to print\n";   else      integer_stack.Print();   // ----- STRING STACK   cout << "\n\nEntering the string segment of the program...\n";   string_stack.Push("Hello");   string_stack.Push("This");   string_stack.Push("is");   string_stack.Push("a");   string_stack.Push("test");   cout << "Here is the string stack...\n";   string_stack.Print();   popped_str = string_stack.Pop();   cout << "I just popped : " << popped_str << "\n\n";   string_stack.Print();   // ----- DATE STACK   cout << "\nEntering the date protion of the stack driver...\n";   for (i=0; i<20; ++i)      date_stack.Push(date(rand()%12+1, rand()%28+1, rand()%2000));   cout << "Here is the date stack...\n";   date_stack.Print();   // successful completion   return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -