#include "naredba.hpp" #include #include #include using namespace std; Naredba::~Naredba() { } void IspisStringa::izvrsi() const { cout << _s << endl; } void IspisIzraza::izvrsi() const { cout << _i->vrednost() << endl; } IspisIzraza::~IspisIzraza() { delete _i; } void Blok::izvrsi() const { for (unsigned i = 0; i < _naredbe.size(); i++) _naredbe[i]->izvrsi(); } Blok::~Blok() { for (unsigned i = 0; i < _naredbe.size(); i++) delete _naredbe[i]; } extern map tablica; void Dodela::izvrsi() const { tablica[_ime] = _i->vrednost(); } Dodela::~Dodela() { delete _i; } void Unesi::izvrsi() const { int tmp; cin >> tmp; tablica[_s] = tmp; } void AkoJeOnda::izvrsi() const { if (_uslov->vrednost() != 0) _n1->izvrsi(); } AkoJeOnda::~AkoJeOnda() { delete _uslov; delete _n1; } void AkoJeOndaInace::izvrsi() const { if (_uslov->vrednost() != 0) _n1->izvrsi(); else _n2->izvrsi(); } AkoJeOndaInace::~AkoJeOndaInace() { delete _uslov; delete _n1; delete _n2; } void DokJe::izvrsi() const { while (_uslov->vrednost() != 0) _n1->izvrsi(); } DokJe::~DokJe() { delete _uslov; delete _n1; } void PraznaNaredba::izvrsi() const { // nista }