Category : oop

sqlite3 *db; sqlite3_stmt *stmt; const char *zErrMsg; sqlite3_open("Resources/Database/database.db", &db); /* * Loads tile objects. */ std::string selectTileObjects = "SELECT * FROM TILEOBJECTS;"; sqlite3_prepare(db, selectTileObjects.c_str(), selectTileObjects.length(), &stmt, &zErrMsg); while (sqlite3_step(stmt) == SQLITE_ROW) { unsigned int artId = sqlite3_column_int(stmt, 0); bool animated = sqlite3_column_int(stmt, 1); bool passable = sqlite3_column_int(stmt, 2); bool mountain = sqlite3_column_int(stmt, 3); bool water ..

Read more

I wanted to create a hash table that contains strings separated by their initial characters. There are 26 vectors in my hash table for 26 letters. #ifndef _MYHASHTABLE_H_ #define _MYHASHTABLE_H_ #include <string> #include <vector> class myHashTable { private: int n; std::vector<int> intMyVector[26]; std::vector<std::string> strMyVector[26]; public: int hashFunction(std::string str); void pushBack(std::string str, int i); void display(); ..

Read more

This is my code: Extractor.hpp template <class O, class D> class Extractor{ public: Extractor( std::vector<O>& input_data, Filtro<O>& filtro, Mapeador<O, D>& mapeador ): _input_data(input_data), _filtro(filtro), _mapeador(mapeador) {} unsigned int getData(std::vector<D>& output) { unsigned total = 0; for (O& data: _input_data) { if (_filtro.dadoValido(data)) { output.push_back(_mapeador.transformaDado(data)); total++; } } return total; } private: std::vector<O>& _input_data; Filtro<O>& _filtro; ..

Read more