Fix All the errors

This commit is contained in:
daniel 2017-04-24 23:06:26 -04:00
parent 62cf24a0de
commit c15879016b
2 changed files with 7 additions and 4 deletions

View File

@ -183,9 +183,9 @@ void Simulation::print()
}
int t = 0;
cout << setw(10) << "TIME";
cout << setw(10) << "TIME ";
while(t <= 60 && t <= lastTime) {
cout << setw(5) << t;
cout << setw(5) << left << t;
t += 5;
}
}

View File

@ -11,15 +11,18 @@ Wire::Wire(int number, bool io, string inName)
int Wire::getValue(int wantedTime) const
{
int tmp;
if (historyTimes.size() == 0 || wantedTime < historyTimes[0]) {
return -1;
}
else {
for (auto i = historyTimes.begin(); i != historyTimes.end(); i++) {
if (*i > wantedTime) {
return historyValues[i - 1 - historyTimes.begin()];
tmp = i - historyTimes.begin();
return historyValues[tmp - 1];
}
}
return *(historyValues.end()-1);
}
}
@ -92,7 +95,7 @@ ostream & operator<<(ostream & out, const Wire & c)
{
if (c.isPrint) {
int len = 0;
out << setw(10) << c.name;
out << setw(10) << c.name + " ";
while (len <= 60 && len <= c.lastEvent)
{
out << setw(0) << c.getChar(len++);