Skip to content
Permalink
Browse files
Final
  • Loading branch information
anumoluu committed Aug 14, 2019
1 parent 098f9b9 commit acd5c7eecc84beb3097aceb4008c06b02369421c
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 70 deletions.
@@ -1,4 +1,4 @@
#include <iostream> #took some help from https://github.coventry.ac.uk/milesd7/122COM-Project/blob/master/DataBase.h
#include <iostream> //took some help from https://github.coventry.ac.uk/milesd7/122COM-Project/blob/master/DataBase.h

#include <array>

@@ -172,30 +172,30 @@ int printStudents(){



auto us = db.get_statement();
auto q1 = db.get_statement();

auto bo = db.get_statement();




us->set_sql( "SELECT * FROM Student" );// set query
q1->set_sql( "SELECT * FROM Student" );// set query

us->prepare();
q1->prepare();




while( us->step()){
while( q1->step()){

if (us->get_int(0) < 10){// if datas from DB is less than 10 , spaces between id and name is 5
if (q1->get_int(0) < 5){

cout <<" "<< us->get_int(0) << " " << us->get_text(1) << " " << us->get_text(2)<<endl;
cout <<" "<< q1->get_int(0) << " " << q1->get_text(1) << " " << q1->get_text(2)<<endl;

}

else{ //// if datas from DB is more than 10 , spaces between id and name is 4..
else{

cout<<" "<<us-> get_int(0) << " " << us->get_text(1) <<" " << us->get_text(2)<<endl;
cout<<" "<<q1-> get_int(0) << " " << q1->get_text(1) <<" " << q1->get_text(2)<<endl;



BIN +4.55 KB (110%) hello
Binary file not shown.
BIN +141 Bytes (100%) hello3
Binary file not shown.
BIN +38.7 KB hello4
Binary file not shown.
@@ -1,57 +1,18 @@
/**
* Copyrights:
* Netlogic Belgium:
* Ruben De Smet
*
* this file is licensed under the terms stated in the LICENCE file
*
*/



#include <sqlite3.h>

#include <string>

#include <vector>

#include <exception>

#include <memory>



#ifndef SQLITEPP

#define SQLITEPP



namespace sqlite

{

class sqlite;

class statement;

typedef std::shared_ptr<statement> statement_ptr;

typedef std::shared_ptr<sqlite> sqlite_ptr;



class exception : public std::exception

{

friend statement;

friend sqlite;
@@ -455,35 +416,17 @@ namespace sqlite
return st;

}

int64_t last_insert_id()

{

return sqlite3_last_insert_rowid(this->_db);

}

virtual ~sqlite()

{

sqlite3_close(this->_db);

}

private:

std::string _filename;



sqlite3* _db;

};

}



#endif
0 name
Empty file.
@@ -0,0 +1,51 @@
#include "database.h"
using namespace std;
int main(){

int Lect_id,stu_id;
string Lect_name,name,class1,b;
cout<< "enter lecturer name"<<endl;
cin>>Lect_name;
Lect_id: cout<< "enter lecturer id"<<endl;
Lect_id=0;
cin>>Lect_id;
if (Lect_id>9999999){

cout<<"Enter valid Lecturer ID"<<endl;
goto Lect_id;
}
else{
cout<<"Lecturer ID accepted"<<endl;
UploadLecturer(Lect_id, Lect_name);
}

lect:cout<<"Do you want have a look at the lecturers' list? (y/n)"<<endl;
cin>>b;
if (b=="y" || b== "Y"){
printLecturers();

}
else if (b=="n" || b=="N"){

cout<< "okay"<<endl;
cout<< "enter student name"<<endl;
cin>>name;
cout<< "enter student id"<<endl;
cin>>stu_id;
cout<< "enter class code"<<endl;
cin>> class1;
UploadStudent(stu_id, name, class1);
printStudents();
}
else{
cout<< "enter a valid input"<<endl;
goto lect;

}
return 1;


// I tried writing in more code, but it isnt working perfectly


}
@@ -6,18 +6,18 @@ int main(){
cout<< "enter lecturer name"<<endl;
cin>>Lect_name;
cout<< "enter lecturer id"<<endl;
cin>>Lect_id;
cin>>Lect_id;

UploadLecturer(Lect_id, Lect_name);
printLecturers();

cout<< "enter student name"<<endl;
cin>>name;
cout<< "enter student id"<<endl;
cin>>stu_id;
cin>>stu_id;
cout<< "enter class code"<<endl;
cin>> class1;
UploadStudent(stu_id, name, class1);
printStudents();

return 1;
}
BIN +0 Bytes (100%) uni_info.db
Binary file not shown.

0 comments on commit acd5c7e

Please sign in to comment.