-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.cpp
27 lines (26 loc) · 845 Bytes
/
main.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
#include "LinkedQueue.h"
#include "SymbolTable.h"
#include "Portfolio.h"
#include <iostream>
#include <string>
using namespace std;
int main() {
ifstream myFile("symboldata.txt");
SymbolTable aTable(myFile);
myFile.close();
ifstream secondFile("stockdata.txt");
std::string line;
Portfolio b(aTable);
if (secondFile.is_open()) {
while (getline(secondFile, line)) {
string buySell = line.substr(0, line.find(" "));
string sym = line.substr(line.find_last_of(" ") + 1);
line = line.substr(2);
int numShares = stoi(line.substr(0, line.find(" ")));
double price = stod(line.substr(line.find(" ") + 1, line.find_last_of(" ")));
b.processTransaction(buySell, numShares, price, sym);
}
}
b.toString();
secondFile.close();
}