cs 302 project

29
PA06 Samuel Gbafa Generated by Doxygen 1.7.6.1 Wed Oct 8 2014 19:04:28

Upload: sampe12

Post on 02-Jun-2018

224 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CS 302 Project

8/10/2019 CS 302 Project

http://slidepdf.com/reader/full/cs-302-project 1/29

PA06

Samuel Gbafa

Generated by Doxygen 1.7.6.1

Wed Oct 8 2014 19:04:28

Page 2: CS 302 Project

8/10/2019 CS 302 Project

http://slidepdf.com/reader/full/cs-302-project 2/29

Page 3: CS 302 Project

8/10/2019 CS 302 Project

http://slidepdf.com/reader/full/cs-302-project 3/29

Contents

1 Main Page   1

2 Class Index   3

2.1 Class List   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

3 File Index   5

3.1 File List   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

4 Class Documentation   7

4.1 ExprTree< DataType > Class Template Reference   . . . . . . . . . . . 7

4.1.1 Constructor & Destructor Documentation . . . . . . . . . . . . . 8

4.1.1.1 ExprTree   . . . . . . . . . . . . . . . . . . . . . . . . 8

4.1.1.2 ExprTree   . . . . . . . . . . . . . . . . . . . . . . . . 8

4.1.1.3   ∼ExprTree   . . . . . . . . . . . . . . . . . . . . . . . 8

4.1.2 Member Function Documentation   . . . . . . . . . . . . . . . . 8

4.1.2.1 build   . . . . . . . . . . . . . . . . . . . . . . . . . . 8

4.1.2.2 build_Helper   . . . . . . . . . . . . . . . . . . . . . . 9

4.1.2.3 clear   . . . . . . . . . . . . . . . . . . . . . . . . . . 9

4.1.2.4 clear_Helper   . . . . . . . . . . . . . . . . . . . . . . 10

4.1.2.5 commute   . . . . . . . . . . . . . . . . . . . . . . . . 11

4.1.2.6 commute_Helper . . . . . . . . . . . . . . . . . . . . 11

4.1.2.7 copy_Helper   . . . . . . . . . . . . . . . . . . . . . . 12

4.1.2.8 equivalent_Helper   . . . . . . . . . . . . . . . . . . . 13

4.1.2.9 evaluate   . . . . . . . . . . . . . . . . . . . . . . . . 13

4.1.2.10 evaluate_Helper   . . . . . . . . . . . . . . . . . . . . 14

4.1.2.11 expression   . . . . . . . . . . . . . . . . . . . . . . . 15

Page 4: CS 302 Project

8/10/2019 CS 302 Project

http://slidepdf.com/reader/full/cs-302-project 4/29

ii CONTENTS

4.1.2.12 expression_Helper   . . . . . . . . . . . . . . . . . . . 15

4.1.2.13 isEquivalent   . . . . . . . . . . . . . . . . . . . . . . 16

4.1.2.14 isLeaf . . . . . . . . . . . . . . . . . . . . . . . . . . 17

4.1.2.15 operator= . . . . . . . . . . . . . . . . . . . . . . . . 17

4.1.2.16 showHelper   . . . . . . . . . . . . . . . . . . . . . . 17

4.1.2.17 showStructure   . . . . . . . . . . . . . . . . . . . . . 17

4.1.3 Member Data Documentation . . . . . . . . . . . . . . . . . . . 18

4.1.3.1 root  . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

4.2 ExprTree< DataType >::ExprTreeNode Class Reference   . . . . . . . . 18

4.2.1 Constructor & Destructor Documentation . . . . . . . . . . . . . 184.2.1.1 ExprTreeNode   . . . . . . . . . . . . . . . . . . . . . 18

4.2.2 Member Data Documentation . . . . . . . . . . . . . . . . . . . 18

4.2.2.1 dataItem   . . . . . . . . . . . . . . . . . . . . . . . . 18

4.2.2.2 left   . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

4.2.2.3 right   . . . . . . . . . . . . . . . . . . . . . . . . . . 18

5 File Documentation   21

5.1 config.h File Reference   . . . . . . . . . . . . . . . . . . . . . . . . . . 21

5.1.1 Define Documentation   . . . . . . . . . . . . . . . . . . . . . . 21

5.1.1.1 LAB8_TEST1   . . . . . . . . . . . . . . . . . . . . . 21

5.1.1.2 LAB8_TEST2   . . . . . . . . . . . . . . . . . . . . . 21

5.1.1.3 LAB8_TEST3   . . . . . . . . . . . . . . . . . . . . . 21

5.2 debug.cpp File Reference   . . . . . . . . . . . . . . . . . . . . . . . . . 21

5.2.1 Function Documentation   . . . . . . . . . . . . . . . . . . . . . 22

5.2.1.1 boolTest   . . . . . . . . . . . . . . . . . . . . . . . . 22

5.2.1.2 count   . . . . . . . . . . . . . . . . . . . . . . . . . . 22

5.2.1.3 print   . . . . . . . . . . . . . . . . . . . . . . . . . . 22

5.3 ExpressionTree.cpp File Reference   . . . . . . . . . . . . . . . . . . . . 22

5.4 ExpressionTree.h File Reference   . . . . . . . . . . . . . . . . . . . . . 22

5.4.1 Detailed Description   . . . . . . . . . . . . . . . . . . . . . . . 22

5.5 ExpressionTree_withShow.cpp File Reference   . . . . . . . . . . . . . . 22

5.6 ptest.cpp File Reference   . . . . . . . . . . . . . . . . . . . . . . . . . 23

5.6.1 Function Documentation   . . . . . . . . . . . . . . . . . . . . . 23

5.6.1.1 dummy   . . . . . . . . . . . . . . . . . . . . . . . . . 23

Generated on Wed Oct 8 2014 19:04:28 for PA06 by Doxygen

Page 5: CS 302 Project

8/10/2019 CS 302 Project

http://slidepdf.com/reader/full/cs-302-project 5/29

CONTENTS iii

5.6.1.2 main   . . . . . . . . . . . . . . . . . . . . . . . . . . 23

5.7 show8.cpp File Reference . . . . . . . . . . . . . . . . . . . . . . . . . 23

5.8 test8.cpp File Reference   . . . . . . . . . . . . . . . . . . . . . . . . . 23

5.8.1 Function Documentation   . . . . . . . . . . . . . . . . . . . . . 23

5.8.1.1 dummy   . . . . . . . . . . . . . . . . . . . . . . . . . 23

5.8.1.2 main   . . . . . . . . . . . . . . . . . . . . . . . . . . 23

Generated on Wed Oct 8 2014 19:04:28 for PA06 by Doxygen

Page 6: CS 302 Project

8/10/2019 CS 302 Project

http://slidepdf.com/reader/full/cs-302-project 6/29

Page 7: CS 302 Project

8/10/2019 CS 302 Project

http://slidepdf.com/reader/full/cs-302-project 7/29

Chapter 1

Main Page

This program will prompt the user for a mathematical expression, and turn it into a Tree

with an equivalent value and structure. It uses recursion and a class to do this.

Page 8: CS 302 Project

8/10/2019 CS 302 Project

http://slidepdf.com/reader/full/cs-302-project 8/29

2 Main Page

Generated on Wed Oct 8 2014 19:04:28 for PA06 by Doxygen

Page 9: CS 302 Project

8/10/2019 CS 302 Project

http://slidepdf.com/reader/full/cs-302-project 9/29

Chapter 2

Class Index

2.1 Class List

Here are the classes, structs, unions and interfaces with brief descriptions:

ExprTree< DataType >   . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   7

ExprTree< DataType >::ExprTreeNode   . . . . . . . . . . . . . . . . . . . .   18

Page 10: CS 302 Project

8/10/2019 CS 302 Project

http://slidepdf.com/reader/full/cs-302-project 10/29

4 Class Index

Generated on Wed Oct 8 2014 19:04:28 for PA06 by Doxygen

Page 11: CS 302 Project

8/10/2019 CS 302 Project

http://slidepdf.com/reader/full/cs-302-project 11/29

Chapter 3

File Index

3.1 File List

Here is a list of all files with brief descriptions:

config.h   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   21

debug.cpp   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   21

ExpressionTree.cpp   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   22

ExpressionTree.h

A program to make an Expression into a tree format . . . . . . . . .   22

ExpressionTree_withShow.cpp   . . . . . . . . . . . . . . . . . . . . . . . . .   22

ptest.cpp   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   23

show8.cpp   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   23

test8.cpp   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   23

Page 12: CS 302 Project

8/10/2019 CS 302 Project

http://slidepdf.com/reader/full/cs-302-project 12/29

6 File Index

Generated on Wed Oct 8 2014 19:04:28 for PA06 by Doxygen

Page 13: CS 302 Project

8/10/2019 CS 302 Project

http://slidepdf.com/reader/full/cs-302-project 13/29

Chapter 4

Class Documentation

4.1 ExprTree< DataType > Class Template Reference

#include   <ExpressionTree.h>

Classes

• class ExprTreeNode

Public Member Functions

•   ExprTree ()

•   ExprTree (const ExprTree &source)

•   ExprTree & operator= (const ExprTree &source)

•   ∼ExprTree ()

• void build ()

• void expression () const

• DataType evaluate () const throw (logic_error)

• void clear ()

• void commute ()

• bool isEquivalent (const ExprTree &source) const• void showStructure () const

Private Member Functions

• bool isLeaf (ExprTreeNode  ∗base) const

• void build_Helper (ExprTreeNode  ∗&base)

• void showHelper (ExprTreeNode  ∗p, int level) const

• void expression_Helper (ExprTreeNode  ∗base) const

• DataType evaluate_Helper (ExprTreeNode  ∗base) const

Page 14: CS 302 Project

8/10/2019 CS 302 Project

http://slidepdf.com/reader/full/cs-302-project 14/29

8 Class Documentation

• void clear_Helper (ExprTreeNode  ∗base) const

• void copy_Helper (ExprTreeNode ∗

&base, ExprTreeNode ∗

other)• void commute_Helper (ExprTreeNode  ∗base)

• bool equivalent_Helper (ExprTreeNode  ∗base, ExprTreeNode  ∗other) const

Private Attributes

•   ExprTreeNode  ∗  root

template<typename DataType> class ExprTree< DataType>

4.1.1 Constructor & Destructor Documentation

4.1.1.1 template<typename DataType > ExprTree< DataType>::ExprTree ( )

4.1.1.2 template<typename DataType > ExprTree< DataType >::ExprTree  ( const

ExprTree< DataType > & source   )

4.1.1.3 template<typename DataType > ExprTree< DataType>::∼ExprTree ( )

4.1.2 Member Function Documentation

4.1.2.1 template<typename DataType > void ExprTree< DataType>::build ( )

This function uses a helper to create the entire tree based on helper’s prompts and

recursive execution.

Precondition

The tree will be empty

Postcondition

The tree will be filled appropriately with the values and structure of the input ex-

pression

Exceptions

None 

Note

Uses a helper function to do the assignments

Generated on Wed Oct 8 2014 19:04:28 for PA06 by Doxygen

Page 15: CS 302 Project

8/10/2019 CS 302 Project

http://slidepdf.com/reader/full/cs-302-project 15/29

4.1 ExprTree< DataType > Class Template Reference 9

Returns

None, only updates data members

4.1.2.2 template<typename DataType > void ExprTree< DataType >::build_Helper (

ExprTreeNode ∗& base   )   [private]

This function prompts the user for input for the current node, then continues to build the

tree. If the input is an operator, it then creates a new node and builds the left, then right.

If the input is a number, it creates a new node for it

Parameters

base    The node that needs to be built

Precondition

The tree can exist or not

Postcondition

A tree as been built

Exceptions

None 

Note

Uses recursion on the children in a pre-order traversal to propogate the effect

through the entire tree, if the input is an operator

Returns

None

4.1.2.3 template<typename DataType > void ExprTree< DataType >::clear ( )

This function uses a helper to delete the entire tree.

Precondition

The tree will be filled appropriately with the values and structure of the input ex-

pression

Generated on Wed Oct 8 2014 19:04:28 for PA06 by Doxygen

Page 16: CS 302 Project

8/10/2019 CS 302 Project

http://slidepdf.com/reader/full/cs-302-project 16/29

10 Class Documentation

Postcondition

The tree will have no data and will be cleared with no memory leaks

Exceptions

None 

Note

Uses a helper function to do the deletion

Returns

None, only updates data members

4.1.2.4 template<typename DataType > void ExprTree< DataType >::clear_Helper (

ExprTreeNode ∗ base   ) const   [private]

This function removes the children of the current node, then removes itself.

Parameters

base    The node that will have its children and self deleted

Precondition

The current node will not be NULL.

Postcondition

The nodes in the tree will be de-allocated from that point in the tree downward

Exceptions

None 

Note

Uses recursion on the children in a post-order traversal to propogate the effect

through the entire tree

Returns

None, only changes data members

Generated on Wed Oct 8 2014 19:04:28 for PA06 by Doxygen

Page 17: CS 302 Project

8/10/2019 CS 302 Project

http://slidepdf.com/reader/full/cs-302-project 17/29

4.1 ExprTree< DataType > Class Template Reference 11

4.1.2.5 template<typename DataType > void ExprTree< DataType >::commute ( )

This function uses a helper to delete the entire tree.

Precondition

The tree will be filled appropriately with the values and structure of the input ex-

pression

Postcondition

The tree will have no data and will be cleared with no memory leaks

Exceptions

None 

Note

Uses a helper function to do the deletion

Returns

None, only updates data members

4.1.2.6 template<typename DataType > void ExprTree< DataType >::commute_Helper (

ExprTreeNode ∗ base   )   [private]

This function swaps the values of the left and right nodes recursively to commute the

entire tree.

Parameters

base    The node that will have its children swapped

Precondition

The current node will not be NULL.

Postcondition

Both children will have swapped values

Exceptions

None 

Generated on Wed Oct 8 2014 19:04:28 for PA06 by Doxygen

Page 18: CS 302 Project

8/10/2019 CS 302 Project

http://slidepdf.com/reader/full/cs-302-project 18/29

12 Class Documentation

Note

Uses recursion on the children in a pre-order traversal to propogate the effectthrough the entire tree

Returns

None, only changes data members

4.1.2.7 template<typename DataType > void ExprTree< DataType >::copy_Helper (

ExprTreeNode ∗& base,   ExprTreeNode ∗ other   )   [private]

This function copies a tree from the current node and onwards. If the source isn’t on a

NULL pointer, it copies the value of the source into a new node (passed by reference)

then tries to copy the children by calling itself upon them, until it finds a NULL termination

in the source tree.

Parameters

base    The node that will be assigned and built upon

other    The source node that will be copied from

Precondition

The current node will be NULL, and the other node will not be NULL

Postcondition

The nodes in the tree will be allocated and assigned from that point in the tree

downward, in the structure defined by the source tree

Exceptions

None 

NoteUses recursion on the children in a pre-order traversal to propogate the effect

through the entire tree

Returns

None, only changes data members, and the by-reference node parameter

Generated on Wed Oct 8 2014 19:04:28 for PA06 by Doxygen

Page 19: CS 302 Project

8/10/2019 CS 302 Project

http://slidepdf.com/reader/full/cs-302-project 19/29

4.1 ExprTree< DataType > Class Template Reference 13

4.1.2.8 template<typename DataType > bool ExprTree< DataType>::equivalent_Helper

(   ExprTreeNode∗

 base,   ExprTreeNode∗

 other   ) const  [private]

This function checks if the current sub-tree is equivalent to the other by the rules of

commutativity. If both nodes are NULL, it assumes equivalence. If both nodes are not

NULL, it can proceed to check further. If the nodes have the same value, it can proceed

to check further. If the nodes are numbers, it assumes equivalence. Otherwise, it checks

the rules of operator commutativity: If the operator is addition or multiplication, it returns

true when the children are equivalently swapped perfectly or otherwise equivalent. -

Otherwise, the children must be completely equivalent for the operators to be equivalent

to each other. All other cases return false.

Parameters

base    The node that will be checked against the source

other    The node that serves as the point of reference

Precondition

The current node will represent a valid tree, and the source node will represent a

valid tree.

Postcondition

The nodes and sub-trees will be evaluated for equivalence under the rules of com-

mutativity

Exceptions

None 

Note

Uses recursion on the children in a post-order traversal to propagate the effect

through the entire tree

Returns

A boolean representing if the two sub-trees are equivalent or not

4.1.2.9 template<typename DataType > DataType ExprTree< DataType >::evaluate ( )

const throw (logic error)

This function uses a helper to evaluate the value of entire tree based on helper’s recur-

sive execution.

Generated on Wed Oct 8 2014 19:04:28 for PA06 by Doxygen

Page 20: CS 302 Project

8/10/2019 CS 302 Project

http://slidepdf.com/reader/full/cs-302-project 20/29

14 Class Documentation

Precondition

The tree will be filled appropriately with the values and structure of the input ex-pression

Postcondition

The value of the tree and intended expression will be output to screen

Exceptions

logic_error    if a division by 0 occurs

Note

Uses a helper function to do the iteration and output

Returns

The value of the expression tree, as the data type specified

4.1.2.10 template<typename DataType > DataType  ExprTree< DataType

>::evaluate_Helper (   ExprTreeNode ∗ base   ) const   [private]

This function checks the current node’s value, then either returns it or evaluates it based

on the children to eventually get the value of the entire tree’s expression. If the current

node is an operator, it assumes that there are 2 children to be operated on, and calls

itself on them to get their value. If the current node is a number, it assumes that there is

nothing under them, and returns their value alone.

Parameters

base    The node that will be evaluated

Precondition

The current node will not be NULL.

Postcondition

The value of the tree will be evaluated from that point in the tree downward

Exceptions

None 

Generated on Wed Oct 8 2014 19:04:28 for PA06 by Doxygen

Page 21: CS 302 Project

8/10/2019 CS 302 Project

http://slidepdf.com/reader/full/cs-302-project 21/29

4.1 ExprTree< DataType > Class Template Reference 15

Note

Uses recursion on the children in a post-order traversal to propogate the effectthrough the entire tree

Returns

The arithmetic result of the tree

4.1.2.11 template<typename DataType > void ExprTree< DataType >::expression ( )

const

This function uses a helper to write the tree’s expression in standard notation based on

helper’s recursive execution.

Precondition

The tree will be filled appropriately with the values and structure of the input ex-

pression

Postcondition

The tree will be output to screen with a similar structure

Exceptions

None 

Note

Uses a helper function to do the iteration and output

Returns

None

4.1.2.12 template<typename DataType > void ExprTree< DataType

>::expression_Helper (   ExprTreeNode ∗ base   ) const   [private]

This function creates a standard visual of the expression tree from the current node.

Parameters

base    The node that will be visualized

Generated on Wed Oct 8 2014 19:04:28 for PA06 by Doxygen

Page 22: CS 302 Project

8/10/2019 CS 302 Project

http://slidepdf.com/reader/full/cs-302-project 22/29

16 Class Documentation

Precondition

The current node will not be NULL.

Postcondition

The tree will be output in an American format

Exceptions

None 

Note

Uses recursion on the children in an in-order traversal to propogate the effect

through the entire tree

Returns

None

4.1.2.13 template<typename DataType > bool ExprTree< DataType>::isEquivalent (

const ExprTree< DataType > & source   ) const

This function checks if the other tree is equivalent by the rules of commutativity to thecalling tree. It uses a helper to do this.

Parameters

source    The other tree to check

Precondition

The tree will be filled appropriately with the values and structure of the input ex-

pression

Postcondition

Both trees will be checked for equivalence by the helper.

Exceptions

None 

Generated on Wed Oct 8 2014 19:04:28 for PA06 by Doxygen

Page 23: CS 302 Project

8/10/2019 CS 302 Project

http://slidepdf.com/reader/full/cs-302-project 23/29

4.1 ExprTree< DataType > Class Template Reference 17

Note

Uses a helper function to do the iteration and checks per node

Returns

boolean value demonstrating if the trees are the same under the rules of commu-

tativity.

4.1.2.14 template<typename DataType > bool ExprTree< DataType >::isLeaf (

ExprTreeNode ∗ base   ) const   [private]

This function determines if the node passed to it is at the bottom of the tree (a leaf)

Parameters

base    The node to be checked

Precondition

A tree exist

Postcondition

No changes have occurred

Exceptions

None 

Note

None

Returns

True if both child Nodes are Null, False otherwise

4.1.2.15 template<typename DataType > ExprTree< DataType> & ExprTree< DataType

>::operator= ( const ExprTree< DataType> & source   )

4.1.2.16 template<typename DataType > void ExprTree< DataType >::showHelper (

ExprTreeNode ∗ p,   int level   ) const   [private]

4.1.2.17 template<typename DataType > void ExprTree< DataType>::showStructure ( )

const

Generated on Wed Oct 8 2014 19:04:28 for PA06 by Doxygen

Page 24: CS 302 Project

8/10/2019 CS 302 Project

http://slidepdf.com/reader/full/cs-302-project 24/29

18 Class Documentation

4.1.3 Member Data Documentation

4.1.3.1 template<typename DataType > ExprTreeNode∗ ExprTree< DataType>::root

[private]

The documentation for this class was generated from the following files:

•   ExpressionTree.h

•   ExpressionTree.cpp

•   ExpressionTree_withShow.cpp

•   show8.cpp

4.2 ExprTree< DataType >::ExprTreeNode Class Reference

Public Member Functions

•   ExprTreeNode (char elem, ExprTreeNode  ∗ leftPtr, ExprTreeNode  ∗rightPtr)

Public Attributes

• char dataItem

•   ExprTreeNode  ∗  left

•   ExprTreeNode  ∗  right

template<typename DataType> class ExprTree< DataType>::ExprTreeNode

4.2.1 Constructor & Destructor Documentation

4.2.1.1 template<typename DataType > ExprTree< DataType>::ExprTreeNode::Expr-

TreeNode  ( char elem,   ExprTreeNode  ∗  leftPtr,   ExprTreeNode  ∗  rightPtr 

)

4.2.2 Member Data Documentation

4.2.2.1 template<typename DataType > char ExprTree< DataType

>::ExprTreeNode::dataItem

4.2.2.2 template<typename DataType > ExprTreeNode∗ ExprTree< DataType

>::ExprTreeNode::left

4.2.2.3 template<typename DataType > ExprTreeNode  ∗  ExprTree< DataType

>::ExprTreeNode::right

The documentation for this class was generated from the following files:

Generated on Wed Oct 8 2014 19:04:28 for PA06 by Doxygen

Page 25: CS 302 Project

8/10/2019 CS 302 Project

http://slidepdf.com/reader/full/cs-302-project 25/29

4.2 ExprTree< DataType >::ExprTreeNode Class Reference 19

•   ExpressionTree.h

•   ExpressionTree.cpp•   ExpressionTree_withShow.cpp

Generated on Wed Oct 8 2014 19:04:28 for PA06 by Doxygen

Page 26: CS 302 Project

8/10/2019 CS 302 Project

http://slidepdf.com/reader/full/cs-302-project 26/29

20 Class Documentation

Generated on Wed Oct 8 2014 19:04:28 for PA06 by Doxygen

Page 27: CS 302 Project

8/10/2019 CS 302 Project

http://slidepdf.com/reader/full/cs-302-project 27/29

Chapter 5

File Documentation

5.1 config.h File Reference

Defines

• #define  LAB8_TEST1 0

• #define  LAB8_TEST2 1

• #define  LAB8_TEST3 1

5.1.1 Define Documentation

5.1.1.1 #define LAB8_TEST1 0

Expression Tree class (Lab 8) configuration file. Activate test #N by defining the corre-

sponding LAB8_TESTN to have the value 1.

5.1.1.2 #define LAB8_TEST2 1

5.1.1.3 #define LAB8_TEST3 1

5.2 debug.cpp File Reference

#include   <iostream> #include   <string>

Functions

• void count (string output)

• void print (string output)

• void boolTest (string output, bool val)

Page 28: CS 302 Project

8/10/2019 CS 302 Project

http://slidepdf.com/reader/full/cs-302-project 28/29

22 File Documentation

5.2.1 Function Documentation

5.2.1.1 void boolTest ( string output,   bool val   )

5.2.1.2 void count ( string output   )

5.2.1.3 void print ( string output   )

5.3 ExpressionTree.cpp File Reference

#include "ExpressionTree.h"

5.4 ExpressionTree.h File Reference

A program to make an Expression into a tree format.

#include   <stdexcept> #include   <iostream>

Classes

• class ExprTree< DataType >

• class ExprTree< DataType >::ExprTreeNode

5.4.1 Detailed Description

A program to make an Expression into a tree format.

Author

Samuel Gbafa

Version

1.0

The program takes a user input in prefix form, and represents it in a Tree, commutingand evaluating it.

Date

Wednesday, October 8th, 2014

5.5 ExpressionTree withShow.cpp File Reference

#include "ExpressionTree.h"

Generated on Wed Oct 8 2014 19:04:28 for PA06 by Doxygen

Page 29: CS 302 Project

8/10/2019 CS 302 Project

http://slidepdf.com/reader/full/cs-302-project 29/29

5.6 ptest.cpp File Reference 23

5.6 ptest.cpp File Reference

#include   <iostream>   #include   <stdexcept>   #include "-

ExpressionTree.cpp"

Functions

•   template<typename DataType >

void dummy (ExprTree< DataType > copyTree)

• int main ()

5.6.1 Function Documentation

5.6.1.1 template<typename DataType > void dummy (   ExprTree< DataType> copyTree   )

5.6.1.2 int main ( )

5.7 show8.cpp File Reference

5.8 test8.cpp File Reference

#include   <iostream>   #include   <stdexcept>   #include "-

ExpressionTree.cpp" #include "config.h"

Functions

•   template<typename DataType >

void dummy (ExprTree< DataType > copyTree)

• int main ()

5.8.1 Function Documentation

5.8.1.1 template<typename DataType > void dummy (   ExprTree< DataType> copyTree   )

5.8.1.2 int main ( )

Generated on Wed Oct 8 2014 19:04:28 for PA06 by Doxygen