Skip to content
Permalink
master
Switch branches/tags

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?
Go to file
 
 
Cannot retrieve contributors at this time
//Author:Nicolas Maxoutis
#include <iostream>
#include <string>
#include <fstream>
#include <vector>
#include "libsqlite.hpp"
using namespace std;
// void scorePrint ()// this function will print the High Score database
// { sqlite::sqlite db( "PlayerRecords.sqlite" ); // open database
// auto cur = db.get_statement(); // create query
// cur->set_sql( "SELECT * FROM playerRecords;" );
// cur->prepare(); // run query
// string tName;
// int sScore;
// while(cur->step()){
// tName = get_text(0);
// sScore = get_int(1);
// cout <<"Name "<< "Score"<<endl;
// cout <<tName<<sScore<<endl;
//
int main()
{
int win_status = 1;
int score1 = 0;
int score2 = 0;
string player1 = "Player1";
string player2 = "Player2";
if(win_status == 1){
cout<<"Player1 wins"<<endl;
score1 = score1 + 20;
}
else if(win_status == 2){
cout<<"Player2 wins"<<endl;
score2 = score2 +20;
}
//win_status = 0;
return 0;
if (score1>score2)
{ sqlite::sqlite db( "PlayerRecords.sqlite" ); // open database
auto cur = db.get_statement(); // create query
cur->set_sql( "INSERT INTO playerRecords(Name, Score) VALUES('Kwstas', '80')" );
cur->prepare(); // run query
// while( cur->step() ) //
}
if (score1<score2)
{
sqlite::sqlite db( "PlayerRecords.sqlite" ); // open database
auto cur = db.get_statement(); // create query
cur->set_sql( "INSERT INTO playerRecords(Name, Score) VALUES('Kwstas', '80')" );
cur->prepare(); // run query
//while( cur->step() ) //
}
return 0;
}