#include<string>
#include <iostream>
#include "sqlite3.h"
using namespace std;
int main()
{
int vib;
char* err;
sqlite3* db;
sqlite3_stmt* stmt;
sqlite3_open("masql.db", &db);
int rc = sqlite3_exec(db, "CREATE TABLE IF NOT EXISTS Egor(login,password);", NULL, NULL, &err);
if (rc != SQLITE_OK) {
cout << "error: " << err << endl;
}
//sqlite3_prepare_v2(db, "select login,password from Egor", -1, &stmt, 0);
cout << "[1]log in" << endl << "[2]sign in" << endl << "[3]number of account" << endl;
cin >> vib;
if (vib == 1)
{
string log, pas;
cout << "input login\n";
cin >> log;
cout << "input password\n";
cin >> pas;
string psdg = "insert into Egor(login, password) VALUES(" + log + "," + pas + "); ";
cout << psdg << endl;
rc = sqlite3_exec(db,psdg.c_str(), NULL, NULL, &err);
if (rc != SQLITE_OK) {
cout << "instert error: " << err;
}
}
sqlite3_close(db);
}
#include<string>
#include <iostream>
#include "sqlite3.h"
using namespace std;
int main()
{
int vib;
char* err;
sqlite3* db;
sqlite3_stmt* stmt;
sqlite3_open("masql.db", &db);
int rc = sqlite3_exec(db, "CREATE TABLE IF NOT EXISTS Egor(login,password);", NULL, NULL, &err);
if (rc != SQLITE_OK) {
cout << "error: " << err << endl;
}
//sqlite3_prepare_v2(db, "select login,password from Egor", -1, &stmt, 0);
cout << "[1]log in" << endl << "[2]sign in" << endl << "[3]number of account" << endl;
cin >> vib;
if (vib == 1)
{
string log, pas;
cout << "input login\n";
cin >> log;
cout << "input password\n";
cin >> pas;
string psdg = "insert into Egor(login,password)VALUES(log,pas); ";
cout << psdg << endl;
rc = sqlite3_exec(db,psdg.c_str(), NULL, NULL, &err);
if (rc != SQLITE_OK) {
cout << "instert error: " << err;
}
}
sqlite3_close(db);
}
#include<string>
#include <iostream>
#include "sqlite3.h"
using namespace std;
int main()
{
int vib;
char* err;
sqlite3* db;
sqlite3_stmt* stmt;
sqlite3_open("masql.db", &db);
int rc = sqlite3_exec(db, "CREATE TABLE IF NOT EXISTS Egor(login varchar(100),password varchar(100));", NULL, NULL, &err);
if (rc != SQLITE_OK) {
cout << "error: " << err << endl;
}
//sqlite3_prepare_v2(db, "select login,password from Egor", -1, &stmt, 0);
cout << "[1]log in" << endl << "[2]sign in" << endl << "[3]number of account" << endl;
cin >> vib;
if (vib == 1)
{
string log, pas;
cout << "input login\n";
cin >> log;
cout << "input password\n";
cin >> pas;
string psdg = "insert into Egor VALUES(" + log + ","+ pas +"); ";
cout << psdg << endl;
rc = sqlite3_exec(db,psdg.c_str(), NULL, NULL, &err);
if (rc != SQLITE_OK) {
cout << "instert error: " << err;
}
}
sqlite3_close(db);
}