-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProg1.cpp
36 lines (34 loc) · 1.21 KB
/
Prog1.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//---------------------------------------------------------------------
// Name: Nicholas Watkins
// Project: Processing expressions based on inputed values/Prog1
// Purpose: This file will run the instances of the RPNEval file and
// by using that obtain the answer to the expressions that are given
// and also outputs the headers.
//---------------------------------------------------------------------
#include <iostream>
#include "Queue.h"
#include "RPNEval.h"
#include "Stack.h"
using namespace std;
//-----------------------------------------------------------------------------
// This function is the main body of the program and runs the entire thing.
//-----------------------------------------------------------------------------
void main ()
{
RPNEval rpn;
int num_expressions;
cin >> num_expressions;
for ( int i = 1; i <= num_expressions; i++ )
{
cout << "Expression " << i << ":" << endl;
rpn.ProcessExpression();
cout << endl;
if ( rpn.IsValid())
cout << "The value is: " << rpn.Value() << endl;
else
cout << "Invalid Expression" << endl;
rpn.PrintIntermediateResults();
cout << endl;
}
cout << "Normal Termination of Program 1!";
}