C++ Integer Stack Driver
/* * A simple client of the IntStack package. */ #include <iostream> using namespace std; #include "intstack.h" int main(int argc, char **argv) { IntStack s1, s2; // Two test stacks. int cnt = 1; // Uh... A counter. // Read in integers until -1, and push each on one stack, and each // times the input ordinal on the other. int intin; // Integer read in. while(true) { cout << "> "; cin >> intin; if(intin == -1) break; s1.push(intin); s2.push(cnt*intin); ++cnt; } // Pop 'em and print 'em while(!s1.isEmpty()) { int inout1 = s1.pop(); int inout2 = s2.pop(); cout << inout1 << " " << inout2 << endl; } }