Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Old-School-Game/tester2.cpp
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
37 lines (23 sloc)
719 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include "libsqlite.hpp" // sqlite library | |
#include <sstream> | |
#include <string> | |
#include <vector> | |
using namespace std; | |
void deck_2() | |
{ | |
sqlite::sqlite db( "table_3.sqlite" ); // open database | |
auto cur = db.get_statement(); // create query | |
cur->set_sql( "SELECT * FROM table_3 ORDER BY random() LIMIT 4 ;"); | |
cur->prepare(); // run query | |
cur->step(); | |
string attack_1, attack_2; | |
attack_1 = cur->get_text(0); | |
attack_2 = cur->get_text(1); | |
while( cur->step() ) // loop over results | |
cout << cur->get_text(0) << "\nAttack 1: " << cur->get_text(1) << "\nAttack 2: " << cur->get_text(2) << "\nAttack 3: " << cur->get_text(3) <<"\n "<< endl; | |
} | |
int main() | |
{ | |
deck_2(); | |
} |