Skip to content
Permalink
Browse files
Update and rename main to main.cpp
  • Loading branch information
mehrar committed Oct 15, 2021
1 parent 9e8946e commit 30fceefdbafc82eaa694f24b327b50f502155264
Show file tree
Hide file tree
Showing 2 changed files with 253 additions and 32 deletions.
32 main

This file was deleted.

253 main.cpp
@@ -0,0 +1,253 @@
#include <iostream>
#include <istream>
#include <stdio.h>
#include <stdlib.h>
#include <sqlite3.h> /*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 :" <<endl;
cout << "Username/Email :"; cin >> log1;
cout << "Password Please :" <<endl; cin >> 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" <<endl;
Timetablesforstudent();
}
else{
cout << "Please try again" <<endl;
secondentry();
}
return 0; // need to return 0/1 depending on the output
}
*/

int Timetablesforstudent(){
student_data s;
string stringtemp;
int inttemp;
cout << "Student ID"; cin >> 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 :" <<endl;
cout << "Username/Email :"; cin >> stringtemp;
s.change_log1(stringtemp);
cout << "Password Please :" <<endl; cin >> 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" <<endl;
cout << "[2] Log In" <<endl;
cin >> option;

switch(option){
case 1:
signup();
break;

case 2:
login();
break;

}
}

int main() {
signuporlogin();
return 0;
}

0 comments on commit 30fceef

Please sign in to comment.