1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
// Program Name: M07 Programming.cpp //
// Name: Dominic Wenger //
// Date: 05/02/2022 //
// Purpose: Create an NBA Database //
#include <iostream>
#include "sqlite/sqlite3.h"
#include <string>
using namespace std;
// callback function //
static int callback(void* data, int argc, char** argv, char** azColName)
{
int i;
fprintf(stderr, "%s: ", (const char*)data);
for (i = 0; i < argc; i++) {
printf("%s = %s\n", azColName[i], argv[i] ? argv[i] : "NULL");
}
printf("\n");
return 0;
}
void menu()
{
sqlite3* db;
sqlite3_stmt* stmt;
sqlite3_open("M08.db", &db);
string data("CALLBACK FUNCTION");
string sql;
int choice;
cout << "Welcome to the Shoe Casa Information Center!\n\nWhat would you like to do?\n\n1. See all avaliable items\n2. See all items of a certain brand\n3. Check sales of each item\n4. Check stock of each item\n5. Exit" << endl;
sql = "SELECT Color,Brand,Name FROM SHOES";
sqlite3_exec(db, sql.c_str(), callback, NULL, NULL);
}
int main()
{
menu();
return 0;
}
|