[Skip Navigation] [CSUSB] / [CNS] / [Comp Sci & Eng] / [R J Botting] / [CSci202] / lab10
[Text Version] [Syllabus] [Schedule] [Glossary] [Resources] [Grading] [Contact] [Question] [Search ]
Notes: [01] [02] [03] [04] [05] [06] [07] [08] [09] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20]
Labs: [01] [02] [03] [04] [05] [06] [07] [08] [09] [10]
Mon May 10 16:11:29 PDT 2010


    CSci202 Laboratory 10 Fixing and Using a Dynamic Data Structure

      Goals -- links, stacks, expressions

      Learn how to work with linked lists. Here are some notes: [ linked.html ] from an earlier class.

      See how to use stacks to evaluate expressions.

      Givens -- Download these before you start

      1. A header file describing a stack class [ stack.h ]
      2. A C++ file defining functions and data in a stack class [ stack.cpp ]
      3. The UML documentation of Stack and Element [ lab10.png ]
      4. A test program that reverses the users input [ reverse.cpp ]
      5. A program that simplifies compilation [ makefile ] (Make sure that your browser does not add a suffix/extension to the file name!)
      6. The main program for the laboratory that evaluates integer expressions [ exprEval.cpp ]


      1. Download the Givens above. Do not change the given names.
      2. Input the command
        and the code will be compiled... if possible. But I have deleted some asterisks and arrows from some of the files.
      3. I have deleted a lot of "*" and "->" from stack.cpp. Use your favorite editor to fix them.
      4. To recompile use the make command again. My Q understands makefiles, by the way.
      5. Once reverse and exprEval are compiled, test reverse:
        Here is an example run
         	Input a text. Finish with CTRL/D on a new line
         	This is a test
         	tset a si sihT

        This may uncover more problems! Find them and fix them

      6. Now get exprEval to work... Here is a couple of test runs
         	input an expression ending with =. Separate integers and operators.
         	1 + 2 * 3 =
         	input an expression ending with =. Separate integers and operators.
         	( 1 + 2 ) * 3 =
      7. Try some other simple tests.

      8. Make some notes on some improvements to exprEval. Here are some tests:
         	1 / 2 =


  1. Algorithm::=A precise description of a series of steps to attain a goal, [ Algorithm ] (Wikipedia).
  2. class::="A description of a set of similar objects that have similar data plus the functions needed to manipulate the data".
  3. Data_Structure::=A small data base.
  4. Function::programming=A selfcontained and named piece of program that knows how to do something.
  5. Gnu::="Gnu's Not Unix", a long running open source project that supplies a very popular and free C++ compiler.
  6. KDE::="Kommon Desktop Environment".
  7. object::="A little bit of knowledge -- some data and some know how", and instance of a class".
  8. OOP::="Object-Oriented Programming", Current paradigm for programming.
  9. Semantics::=Rules determining the meaning of correct statements in a language.
  10. SP::="Structured Programming", a previous paradigm for programming.
  11. STL::="The standard C++ library of classes and functions" -- also called the "Standard Template Library" because many of the classes and functions will work with any kind of data.
  12. Syntax::=The rules determining the correctness and structure of statements in a language, grammar.
  13. Q::software="A program I wrote to make software easier to develop",
  14. TBA::="To Be Announced", something I should do.
  15. TBD::="To Be Done", something you have to do.
  16. UML::="Unified Modeling Language".
  17. void::C++Keyword="Indicates a function that has no return".