Skip to content
Permalink
Browse files
Remove duplicate main function
  • Loading branch information
soperd committed Mar 22, 2019
1 parent a498f87 commit c69c5a907fe1622d20c567257fd340aca95756d7
Showing 1 changed file with 25 additions and 25 deletions.
@@ -29,37 +29,37 @@ int callback(void*, int, char**, char**);
//Inspired from Diana Hintea tutorial 4005CEM. commented for self-understanding.
//Declare function main. Return integer. Two inputs argC and argV.

int main(int argc, char** argv)
{
//Declare structure.
sqlite3* DB;
// int main(int argc, char** argv)
// {
// //Declare structure.
// sqlite3* DB;

//Declare exit as integer and value 0.]
int exit = 0;
// //Declare exit as integer and value 0.]
// int exit = 0;

//exit assigned to open function from SQLite3 library. Opens game.DB and uses structure.
exit = sqlite3_open("game.db", &DB);
// //exit assigned to open function from SQLite3 library. Opens game.DB and uses structure.
// exit = sqlite3_open("game.db", &DB);

//return -1 for unable to open database.
if (exit) {
std::cerr << "Error open DB " << sqlite3_errmsg(DB) << std::endl;
return (-1);
}
//Print out if database opens correctly.
else
std::cout << "Opened Database Successfully!" << std::endl;
// //return -1 for unable to open database.
// if (exit) {
// std::cerr << "Error open DB " << sqlite3_errmsg(DB) << std::endl;
// return (-1);
// }
// //Print out if database opens correctly.
// else
// std::cout << "Opened Database Successfully!" << std::endl;

Item *item = getRandomItem(DB); //Get a random item from the database
// Item *item = getRandomItem(DB); //Get a random item from the database

// Print out the item details
std::cout << item->modName << " ";
std::cout << item->matName << " ";
std::cout << item->itemName << std::endl;
// // Print out the item details
// std::cout << item->modName << " ";
// std::cout << item->matName << " ";
// std::cout << item->itemName << std::endl;

sqlite3_close(DB);
delete item;
return (0);
}
// sqlite3_close(DB);
// delete item;
// return (0);
// }
//inspired from tutorial END

//ITEM GENERATOR

0 comments on commit c69c5a9

Please sign in to comment.