From 30fceefdbafc82eaa694f24b327b50f502155264 Mon Sep 17 00:00:00 2001 From: "Rajdeep Mehra (mehrar)" Date: Fri, 15 Oct 2021 22:57:09 +0100 Subject: [PATCH] Update and rename main to main.cpp --- main | 32 ------- main.cpp | 253 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 253 insertions(+), 32 deletions(-) delete mode 100644 main create mode 100644 main.cpp diff --git a/main b/main deleted file mode 100644 index f9c7fde..0000000 --- a/main +++ /dev/null @@ -1,32 +0,0 @@ -int signuporlogin(){ - int option; - - menu: - cout << "[1] Sign Up" <> option; - - switch(option){ - case 1: - firstentry(); - break; - - case 2: - secondentry(); - break; - - default: - cout << "Choose again." < +#include +#include +#include +#include /*libraries*/ +#include "insert_db.h" +#include "create_db.h" +#include "select_db.h" +using namespace std; + + +class student_data{ + protected: + string modules; + string classes; + int students, studentID; + string lecturers, rooms; + string name, surname, username, email, password, retry, log1, pass1; + int Timing; + int Term; + + public: + string get_modules(){ + return modules; + } + void change_modules(string _modules){ + modules=_modules; + } + string get_classes(){ + return classes; + } + void change_classes(string _classes){ + classes=_classes; + } + int get_students(){ + return students; + } + void change_students(int _students){ + students=_students; + } + int get_studentID(){ + return studentID; + } + void change_studentID(int _studentID){ + students=_studentID; + } + string get_lecturers(){ + return lecturers; + } + void change_lecturers(string _lecturers){ + lecturers=_lecturers; + } + string get_rooms(){ + return rooms; + } + void change_rooms(string _rooms){ + rooms=_rooms; + } + + string get_surname(){ + return surname; + } + void change_surname(string _surname){ + surname=_surname; + } + string get_username(){ + return username; + } + void change_username(string _username){ + username=_username; + } + string get_email(){ + return email; + } + void change_email(string _email){ + email=_email; + } + string get_password(){ + return password; + } + void change_password(string _password){ + password=_password; + } + + string get_log1(){ + return log1; + } + void change_log1(string _log1){ + log1=_log1; + } + string get_pass1(){ + return pass1; + } + void change_pass1(string _pass1){ + pass1=_pass1; + } + string get_name(){ + return name; + } + void change_name(string _name){ + name=_name; + } + int get_Timing(){ + return Timing; + } + void change_Timing(int _timing){ + students=_timing; + } + int get_Term(){ + return Term; + } + void change_Term(int _term){ + Term=_term; + } +}; + + + + +int showingthetimetable(){ + + return 0; // need to return 0/1 depending on the output +} + + + + + + + + /*int secondentry(int len, char* value[]){login your details and check to see if they match the database +cout << "Please enter your student details to Login :" <> log1; +cout << "Password Please :" <> pass1; +sqlite3 *db; +char *column = 0; +int load; +string sql; + +load = sqlite3_open("School.db", &db); + +if(load){ + cout << "DB Error: " << sqlite3_errmsg(db) << endl; + sqlite3_close(db); + return(1); +} + + + +sql = "SELECT password FROM STUDENTDETAILS " + username + ";"; +load = sqlite3_exec(db, sql.c_str(), callback, 0, &column); + +if (pass1 == sql){ + cout << "Successfull Login" <> inttemp; + s.change_studentID(inttemp); + cout << "modules :"; cin >> stringtemp; + s.change_modules(stringtemp); + cout << "classes :"; cin >> stringtemp; + s.change_classes(stringtemp); + cout << "students :"; cin >> inttemp; + s.change_students(inttemp); + cout << "lecturers :"; cin >> stringtemp; + s.change_lecturers(stringtemp); + cout << "rooms :"; cin >> stringtemp; + s.change_rooms(stringtemp); + cout << "Timing :"; cin >> inttemp; + s.change_Timing(inttemp); + cout << "Term :"; cin >> inttemp; + s.change_Term(inttemp); + + return 1; // need to return something afterwards. +} + +int login(){ + student_data s; + string stringtemp; + cout << "Please enter your student details to Login :" <> stringtemp; + s.change_log1(stringtemp); + cout << "Password Please :" <> stringtemp; + s.change_pass1(stringtemp); + Timetablesforstudent(); +} + + +int signup(){ + student_data s; + string stringtemp; + int inttemp; + string pass, retry; + cout << "Student ID"; cin >> inttemp; + s.change_studentID(inttemp); + cout << "Name :"; cin >> stringtemp; + s.change_name(stringtemp); + cout << "Surname :"; cin >> stringtemp; + s.change_surname(stringtemp); + s.change_username( s.get_surname() + s.get_name()[0]); + cout << "Enter your school email :"; cin >> stringtemp; + s.change_email(stringtemp); + cout << "Password :"; cin >> pass; + cout << "Enter Password again :"; cin >> retry; + if (pass == retry){ + cout << "Password match"; + stringtemp = pass; + s.change_password(stringtemp); + } + login(); + + +} + + +int signuporlogin(){ + int option; + + menu: + cout << "[1] Sign Up" <> option; + + switch(option){ + case 1: + signup(); + break; + + case 2: + login(); + break; + + } +} + +int main() { + signuporlogin(); + return 0; +} +