Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Bhanu Pratap Singh Shekhawat, BCA Third Year

188 views

Published on

This is a work by the student of BCA Department student from Third Year studying at Dezyne E'cole College,Ajmer

Published in: Education
  • Be the first to comment

  • Be the first to like this

Bhanu Pratap Singh Shekhawat, BCA Third Year

  1. 1. SUBMITED BY Bhanu Pratap Singh Shekhawat Bachelor of Computer Application II YEAR Dezyne E’cole College www.dezyneecole.com INFORMATION TECHNOLOGY PROJECT REPORT C++ PROGRAMMING Online Exam TOPIC C++
  2. 2. Project Report On C++ Programming At Dezyne E’cole College Ajmer Submitted to Dezyne E’cole College Towards the Partial Fulfillment on Bachelor of Computer Application By Bhanu Pratap Singh Shekhawat Dezyne E’cole College 106/10 Civil Line, Ajmer Tel – 0145-2624679 Www.dezyneecole.com 2016
  3. 3. Acknowledgement I Bhanu Pratap Singh Shekhawat, Student On Dezyne E’cole College, An Extremely Grateful To Each And Every Individual. Who Has Contributed. In Successful Completion Of My Project. I Express My Gratitude Towards Dezyne E’cole College For Their. Guidance and Contrast Supervision As Well As For Providing The Necessary Information And Support Regarding The Completion Of Project Thank You
  4. 4. 1 | P a g e Synopsis This Project Is A Minor. Project Made, Based On The Practical Concept Of C++ This Project Has Made Our Basic Practical Concepts On C++ Strong
  5. 5. 2 | P a g e
  6. 6. 3 | P a g e
  7. 7. 4 | P a g e
  8. 8. 5 | P a g e
  9. 9. 6 | P a g e #include<iostream.h> #include<string.h> #include<conio.h> #include<stdio.h> #include<stdlib.h> #include<dos.h> #include<fstream.h> class exam { public: int qn; char q[200]; char oa[60]; char ob[60]; char oc[60]; char od[60]; char ans[3]; }; class admin { public: char id[60]; char password[60]; }; class student { public: char id[60]; char password[60]; char fname[60]; char lname[60]; }; class result { public: char id[60]; int ca; char fname[60]; char lname[60]; }; class randomq { public:
  10. 10. 7 | P a g e int ran; }; class gd { public: int gdcq; }; exam a; admin b; student c; result e; randomq ra; gd gdv; fstream f; fstream y; void main() { class use { public: void white() { textcolor(0); textbackground(7); for(int i=0;i<2000;i++) { cprintf(" "); } } /*Add Question and answer*/ /*final*/ void data() { white(); a.qn=0; exam w; f.open("exam.dat",ios::in); while(f) { f.read((char *) &w,sizeof(w)); if(f==0) {
  11. 11. 8 | P a g e break; } a.qn=w.qn; } f.close(); a.qn++; gotoxy(30,3); cout<<"Add Question & Answer"; gotoxy(20,5); cout<<"Q."<<a.qn<<" "; cin.getline(a.q,200); gotoxy(20,7); cout<<"A."; cin.getline(a.oa,60); gotoxy(50,7); cout<<"B."; cin.getline(a.ob,60); gotoxy(20,9); cout<<"C."; cin.getline(a.oc,60); gotoxy(50,9); cout<<"D."; cin.getline(a.od,60); gotoxy(30,12); cout<<"Ans."; cin.getline(a.ans,3); textcolor(4); gotoxy(50,15); cprintf("S"); gotoxy(56,15); cprintf("C"); textcolor(BLACK); gotoxy(51,15); cprintf("ave"); gotoxy(57,15); cout<<"ancel"; char n; bk: n=getch(); if(n=='S' || n=='s') { din(); goto en;
  12. 12. 9 | P a g e } else if(n=='c' || n=='C') { goto en; } else { goto bk; } en: } /*Store Question and answer*/ /*final*/ void din() { f.open("exam.dat",ios::app | ios::out); f.write((char *) &a,sizeof(a)); f.close(); } /*Output Question and answer*/ /*final*/ void dout() { gotoxy(2,2); cout<<"Questions :-"; for(int i=1;i<=79;i++) { gotoxy(i,3); cout<<"-"; } int cp=4; exam w; f.open("exam.dat",ios::in); while(f) { f.read((char *) &w,sizeof(w)); if(f==0) { break; } // a.qn=w.qn; // strcpy(a.q,w.q); // strcpy(a.oa,w.oa); // strcpy(a.ob,w.ob); // strcpy(a.oc,w.oc);
  13. 13. 10 | P a g e // strcpy(a.od,w.od); // strcpy(a.ans,w.ans); gotoxy(4,cp); cout<<w.qn<<" "; int k=0,kk=7; while(w.q[k]!='0') { gotoxy(kk,cp); cout<<w.q[k]; if(kk>=65) { if(w.q[k]==32) { kk=7; cp++; } } k++; kk++; } cp+=2; if(cp>=17) { for(int i=1;i<=79;i++) { gotoxy(i,18); cout<<"-"; } gotoxy(5,20); cout<<"Press any key to continue..."; getch(); clrscr(); gotoxy(2,2); cout<<"Questions :-"; for(i=1;i<=79;i++) { gotoxy(i,3); cout<<"-"; } cp=4; } // cout<<w.oa; // cout<<w.ob;
  14. 14. 11 | P a g e // cout<<w.oc; // cout<<w.od; // cout<<w.ans; delay(200); } f.close(); getch(); } /*Make student id*/ /*final*/ void studentid() { idl: white(); gotoxy(30,3); cout<<"Make Student Id"; gotoxy(25,5); cout<<"Id : "; cin.getline(c.id,60); student w; f.open("stu_id.dat",ios::in); while(f) { f.read((char *) &w,sizeof(w)); if(strcmp(c.id,w.id)==0) { cout<<"nId is already exist"; delay(2000); clrscr(); goto idl; } if(f==0) { break; } } f.close(); gotoxy(19,7); cout<<"Password : "; //for input password int sic=-1; while(c.password[sic]!=13) { sic++; c.password[sic]=getch();
  15. 15. 12 | P a g e cout<<"*"; if(c.password[sic]==8) { cout<<"b bb b"; sic-=2; } } c.password[sic]='0'; // cin.getline(c.password,60); gotoxy(17,9); cout<<"First name : "; cin.getline(c.fname,60); gotoxy(18,11); cout<<"Last name : "; cin.getline(c.lname,60); textcolor(4); gotoxy(32,15); cprintf("S"); gotoxy(38,15); cprintf("C"); textcolor(0); gotoxy(33,15); cprintf("ave"); gotoxy(39,15); cout<<"ancel"; char n; cl: n=getch(); if(n=='S' || n=='s') { studentdin(); goto dn; } else if(n=='C' || n=='c') { goto dn; } else { goto cl; } dn: }
  16. 16. 13 | P a g e /*Store student id*/ /*final*/ void studentdin() { f.open("stu_id.dat",ios::app | ios::out); f.write((char *) &c,sizeof(c)); f.close(); } /*Output student id*/ /*final*/ void studentdout() { white(); student w; f.open("stu_id.dat",ios::in); while(f) { f.read((char *) &w,sizeof(w)); if(f==0) { break; } // strcpy(c.id,w.id); // strcpy(c.password,w.password); // strcpy(c.fname,w.fname); // strcpy(c.lname,w.lname); cout<<"t"<<w.id<<endl; cout<<"t"<<w.password<<endl; cout<<"t"<<w.fname<<endl; cout<<"t"<<w.lname<<endl; delay(1000); } f.close(); } /*Make admin data*/ /*Final*/ void adminid() { white(); gotoxy(30,3); cout<<"Make admin Id"; gotoxy(25,5); cout<<"Enter id : "; cin.getline(b.id,60); gotoxy(19,7); cout<<"Enter password : ";
  17. 17. 14 | P a g e cin.getline(b.password,60); textcolor(4); gotoxy(30,10); cprintf("S"); gotoxy(36,10); cprintf("C"); textcolor(0); gotoxy(31,10); cprintf("ave"); gotoxy(37,10); cout<<"ancel"; char n; wi: n=getch(); if(n=='S' || n=='s') { admindin(); goto el; } else if(n=='C' || n=='c') { goto el; } else { goto wi; } el: } /*Store admin id*/ /*Final*/ void admindin() { f.open("admin.dat",ios::app | ios::out); f.write((char *) &b,sizeof(b)); f.close(); } /*Output admin id*/ /*Final*/ void admindout() { white(); admin w; f.open("admin.dat",ios::in); while(f)
  18. 18. 15 | P a g e { f.read((char *) &w, sizeof(w)); if(f==0) { break; } // strcpy(b.id,w.id); // strcpy(b.password,w.password); cout<<w.id<<endl; cout<<w.password<<endl; delay(1000); } f.close(); } /*Change admin id*/ /*Final*/ void changeadminid() { nmp: white(); char oid[60],nid[60]; gotoxy(30,4); cout<<"Change admin Id : "; gotoxy(25,6); cout<<"Old id : "; cin.getline(oid,60); admin w; f.open("admin.dat",ios::in); while(f) { f.read((char *) &w,sizeof(w)); if(f==0) { break; } } f.close(); if(strcmp(oid,w.id)==0) { gotoxy(25,8); cout<<"New id : "; cin.getline(nid,60); textcolor(4); gotoxy(30,12);
  19. 19. 16 | P a g e cprintf("S"); gotoxy(36,12); cprintf("C"); textcolor(0); gotoxy(31,12); cprintf("ave"); gotoxy(37,12); cout<<"ancel"; char n; wl: n=getch(); if(n=='S' || n=='s') { admin w; y.open("tadmin.dat",ios::app | ios::out); f.open("admin.dat",ios::in); while(f) { f.read((char *) &w, sizeof(w)); if(f==0) { break; } if(strcmp(oid,w.id)==0) { strcpy(w.id,nid); y.write((char *) &w, sizeof(w)); } else { y.write((char *) &w, sizeof(w)); } } y.close(); f.close(); remove("admin.dat"); rename("tadmin.dat","admin.dat"); goto cl; } else if(n=='C' || n=='c') { goto cl; }
  20. 20. 17 | P a g e else { goto wl; } } else { gotoxy(30,11); cout<<"Id not match"; delay(1600); clrscr(); goto nmp; } cl: } /*Change admin password*/ /*Final*/ void changeadminpass() { nmp: white(); char opass[60],npass[60],cpass[60]; gotoxy(30,4); cout<<"Change admin password"; gotoxy(25,6); cout<<"Old password : "; //for input password int sic=-1; while(opass[sic]!=13) { sic++; opass[sic]=getch(); cout<<"*"; if(opass[sic]==8) { cout<<"b bb b"; sic-=2; } } opass[sic]='0'; // cin.getline(opass,60); admin w; f.open("admin.dat",ios::in); while(f) {
  21. 21. 18 | P a g e f.read((char *) &w, sizeof(w)); if(f==0) { break; } } f.close(); if(strcmp(opass,w.password)==0) { gotoxy(25,8); cout<<"New password : "; //for input password int sic=-1; while(npass[sic]!=13) { sic++; npass[sic]=getch(); cout<<"*"; if(npass[sic]==8) { cout<<"b bb b"; sic-=2; } } npass[sic]='0'; // cin.getline(npass,60); gotoxy(21,10); cout<<"Confirm password : "; gotoxy(35,12); //for input password sic=-1; while(cpass[sic]!=13) { sic++; cpass[sic]=getch(); cout<<"*"; if(cpass[sic]==8) { cout<<"b bb b"; sic-=2; } } cpass[sic]='0'; // cin.getline(cpass,60); if(strcmp(npass,cpass)==0)
  22. 22. 19 | P a g e { textcolor(4); gotoxy(35,14); cprintf("S"); gotoxy(41,14); cprintf("C"); textcolor(0); gotoxy(36,14); cprintf("ave"); gotoxy(42,14); cout<<"ancel"; char n; wl: n=getch(); if(n=='S' || n=='s') { admin w; y.open("tadmin.dat",ios::app | ios::out); f.open("admin.dat",ios::in); while(f) { f.read((char *) &w, sizeof(w)); if(f==0) { break; } if(strcmp(opass,w.password)==0) { strcpy(w.password,npass); y.write((char *) &w, sizeof(w)); } else { y.write((char *) &w, sizeof(w)); } } y.close(); f.close(); remove("admin.dat"); rename("tadmin.dat","admin.dat"); goto cl; } else if(n=='C' || n=='c')
  23. 23. 20 | P a g e { goto cl; } else { goto wl; } } else { gotoxy(30,13); cout<<"Password not match"; delay(1600); clrscr(); goto nmp; } } else { gotoxy(30,13); cout<<"Password not match"; delay(1600); clrscr(); goto nmp; } cl: } /*Student log in*/ /*Final*/ void studentlog() { white(); gotoxy(30,4); cout<<"Log in"; gotoxy(25,6); cout<<"Id : "; cin.getline(c.id,60); gotoxy(19,8); cout<<"Password : "; //for input password int sic=-1; while(c.password[sic]!=13) { sic++; c.password[sic]=getch();
  24. 24. 21 | P a g e cout<<"*"; if(c.password[sic]==8) { cout<<"b bb b"; sic-=2; } } c.password[sic]='0'; // cin.getline(c.password,60); textcolor(4); gotoxy(30,12); cprintf("L"); gotoxy(39,12); cprintf("C"); textcolor(0); gotoxy(31,12); cprintf("ogin"); gotoxy(40,12); cout<<"ancel"; char n; int g=0; wi: n=getch(); if(n=='L' || n=='l') { student w; f.open("stu_id.dat",ios::in); while(f) { f.read((char *) &w, sizeof(w)); if(strcmp(c.id,w.id)==0 && strcmp(c.password,w.password)==0) { clrscr(); strcpy(c.id,w.id); strcpy(c.password,w.password); strcpy(c.fname,w.fname); strcpy(c.lname,w.lname); g++; break; } g=0; if(f==0)
  25. 25. 22 | P a g e { break; } } f.close(); if(g==0 || g=='0') { gotoxy(30,10); cout<<"Id not valid"; delay(1500); main(); } goto en; } else if(n=='C' || n=='c') { main(); } else { goto wi; } en: } /*Student option*/ /*Final*/ void studentopp() { white(); gotoxy(30,4); cout<<"Welcome "<<c.fname; gotoxy(38,5); cout<<c.lname; gotoxy(30,18); cout<<"Choose your option"; gotoxy(28,7); cout<<"1. Test"; /*Right*/ gotoxy(28,9); cout<<"2. View result"; gotoxy(28,11); cout<<"3. Change Id"; gotoxy(28,13); cout<<"4. Change Password"; gotoxy(28,15);
  26. 26. 23 | P a g e cout<<"5. Log out"; } /*Admin panel*/ /*Final*/ void adminopp() { white(); gotoxy(30,4); cout<<"Choose your option"; gotoxy(28,6); cout<<"1. Add Question and answer"; /*right*/ gotoxy(28,8); cout<<"2. Change admin Id"; /*right*/ gotoxy(28,10); cout<<"3. Change admin password"; /*right*/ gotoxy(28,12); cout<<"4. Make student Id"; /*right*/ gotoxy(28,14); cout<<"5. View student result"; /*Right*/ gotoxy(28,16); cout<<"6. Student modification"; /*Right*/ gotoxy(28,18); cout<<"7. View question"; /*Right*/ gotoxy(28,20); cout<<"8. Delete Questions"; /*Right*/ gotoxy(28,22); cout<<"9. Log out"; } /*Modify student detail*/ /*final*/ void studentmodify() { white(); gotoxy(30,4); cout<<"Choose your option"; gotoxy(28,6); cout<<"1. Id"; /*Right*/ gotoxy(28,8); cout<<"2. Password"; /*Right*/ gotoxy(28,10); cout<<"3. Back"; } /*Change student id*/ /*Final*/ void changestudentid() {
  27. 27. 24 | P a g e nmp: white(); char oid[60],nid[60]; int h=0; gotoxy(30,4); cout<<"Change Student Id : "; gotoxy(25,6); cout<<"Old id : "; cin.getline(oid,60); student w; f.open("stu_id.dat",ios::in); while(f) { f.read((char *) &w, sizeof(w)); if(f==0) { break; } if(strcmp(oid,w.id)==0) { h++; break; } } f.close(); if(h>0) { gotoxy(25,8); cout<<"New id : "; cin.getline(nid,60); textcolor(4); gotoxy(30,12); cprintf("S"); gotoxy(36,12); cprintf("C"); textcolor(0); gotoxy(31,12); cprintf("ave"); gotoxy(37,12); cout<<"ancel"; char n; wl: n=getch();
  28. 28. 25 | P a g e if(n=='S' || n=='s') { student w; y.open("tstu_id.dat",ios::app | ios::out); f.open("stu_id.dat",ios::in); while(f) { f.read((char *) &w, sizeof(w)); if(f==0) { break; } if(strcmp(oid,w.id)==0 && strcmp(c.id,w.id)==0 && strcmp(c.password,w.password)==0) { strcpy(w.id,nid); y.write((char *) &w, sizeof(w)); } else { y.write((char *) &w, sizeof(w)); } } y.close(); f.close(); remove("stu_id.dat"); rename("tstu_id.dat","stu_id.dat"); goto cl; } else if(n=='C' || n=='c') { goto cl; } else { goto wl; } } else { gotoxy(30,11); cout<<"Id not match"; delay(1600);
  29. 29. 26 | P a g e clrscr(); goto cl; } cl: } /*Change student password*/ /*Final*/ void changestudentpass() { nmp: white(); char opass[60],npass[60],cpass[60]; int h=0; gotoxy(30,4); cout<<"Change Student password"; gotoxy(25,6); cout<<"Old password : "; int sic=-1; while(opass[sic]!=13) { sic++; opass[sic]=getch(); cout<<"*"; if(opass[sic]==8) { cout<<"b bb b"; sic-=2; } } opass[sic]='0'; // cin.getline(opass,60); student w; f.open("stu_id.dat",ios::in); while(f) { f.read((char *) &w, sizeof(w)); if(f==0) { break; } if(strcmp(opass,w.password)==0) { h++; break;
  30. 30. 27 | P a g e } } f.close(); if(h>0) { gotoxy(25,8); cout<<"New password : "; int sic=-1; while(npass[sic]!=13) { sic++; npass[sic]=getch(); cout<<"*"; if(npass[sic]==8) { cout<<"b bb b"; sic-=2; } } npass[sic]='0'; // cin.getline(npass,60); gotoxy(21,10); cout<<"Confirm password : "; sic=-1; while(cpass[sic]!=13) { sic++; cpass[sic]=getch(); cout<<"*"; if(cpass[sic]==8) { cout<<"b bb b"; sic-=2; } } cpass[sic]='0'; // cin.getline(cpass,60); if(strcmp(npass,cpass)==0) { textcolor(4); gotoxy(35,14); cprintf("S"); gotoxy(41,14);
  31. 31. 28 | P a g e cprintf("C"); textcolor(0); gotoxy(36,14); cprintf("ave"); gotoxy(42,14); cout<<"ancel"; char n; wl: n=getch(); if(n=='S' || n=='s') { student w; y.open("tstu_id.dat",ios::app | ios::out); f.open("stu_id.dat",ios::in); while(f) { f.read((char *) &w, sizeof(w)); if(f==0) { break; } if(strcmp(opass,w.password)==0 && strcmp(c.id,w.id)==0 && strcmp(c.password,w.password)==0) { strcpy(w.password,npass); y.write((char *) &w, sizeof(w)); } else { y.write((char *) &w, sizeof(w)); } } y.close(); f.close(); remove("stu_id.dat"); rename("tstu_id.dat","stu_id.dat"); goto cl; } else if(n=='C' || n=='c') { goto cl; } else
  32. 32. 29 | P a g e { goto wl; } } else { gotoxy(30,13); cout<<"Password not match"; delay(1600); clrscr(); goto nmp; } } else { gotoxy(30,13); cout<<"Password not match"; delay(1600); clrscr(); goto nmp; } cl: } /*Clock*/ /*Final*/ void clock() { int m,s,ms; m=s=ms=0; cout<<endl<<"t"; for(;1;) { clrscr(); cout<<m<<":"<<s<<":"<<ms; if(m==10) { break; } delay(10); ms++; if(ms==100) { s++; ms=0;
  33. 33. 30 | P a g e if(s==60) { s=0; m++; } } } } /*Test question*/ /*Final*/ void question() { white(); gdv.gdcq=0; exam wa; f.open("exam.dat",ios::in); while(f) { f.read((char *) &wa, sizeof(wa)); if(wa.qn==5) { gdv.gdcq++; break; } if(f==0) { break; } } f.close(); if(gdv.gdcq==0) { gotoxy(25,5); cout<<"Not Edited five Question"; return; } randomq req; y.open("random.dat",ios::in); while(y) { y.read((char *) &req,sizeof(req)); if(y==0) { break;
  34. 34. 31 | P a g e } ra.ran=req.ran; } y.close(); if(ra.ran>=1 && ra.ran<=800) { goto jum; } else { ra.ran=1; } jum: int Qn=0; char as[200]; int anc=0; int ncoun=0; int m,s,ms; m=s=ms=0; clrscr(); exam w; f.open("exam.dat",ios::in); while(f) { back: f.read((char *) &w, sizeof(w)); if(ncoun==0 && ra.ran!=w.qn) { goto back; } ncoun++; if(Qn==5) { ra.ran=w.qn; break; } if(Qn!=5 && f==0) { f.close(); f.open("exam.dat",ios::in); ra.ran=1; goto back; }
  35. 35. 32 | P a g e clrscr(); Qn++; lb: clrscr(); for(;1;) // { gotoxy(25,6); cout<<"Q "<<Qn<<" "; int k=0,kk=30,kkc=6; while(w.q[k]!='0') { gotoxy(kk,kkc); cout<<w.q[k]; if(kk>=65) { if(w.q[k]==32) { kk=30; kkc++; } } k++; kk++; } gotoxy(25,9); cout<<"A. "<<w.oa; gotoxy(45,9); cout<<"B. "<<w.ob; gotoxy(25,11); cout<<"C. "<<w.oc; gotoxy(45,11); cout<<"D. "<<w.od; gotoxy(30,13); cout<<"Ans. "; if(s>=10 && s<=60) { gotoxy(68,3); cout<<"0"<<m<<":"<<s<<":"<<ms; } else { gotoxy(68,3); cout<<"0"<<m<<":0"<<s<<":"<<ms;
  36. 36. 33 | P a g e } if(m==3) { break; } delay(10); ms++; if(ms==100) { s++; ms=0; if(s==60) { s=0; m++; } } if(kbhit()) { gotoxy(35,13); as[0]=getch(); as[1]='0'; if(as[1]!='0') { goto lb; } if(as[0]=='a' || as[0]=='A') { if(as[0]==w.ans[0] || (as[0]+32)==w.ans[0] || (as[0]-32)==w.ans[0]) { anc++; clrscr(); goto en; } goto en; } else if(as[0]=='b' || as[0]=='B') { if(as[0]==w.ans[0] || (as[0]+32)==w.ans[0] || (as[0]-32)==w.ans[0]) { anc++;
  37. 37. 34 | P a g e clrscr(); goto en; } goto en; } else if(as[0]=='c' || as[0]=='C') { if(as[0]==w.ans[0] || (as[0]+32)==w.ans[0] || (as[0]-32)==w.ans[0]) { anc++; clrscr(); goto en; } goto en; } else if(as[0]=='d' || as[0]=='D') { if(as[0]==w.ans[0] || (as[0]+32)==w.ans[0] || (as[0]-32)==w.ans[0]) { anc++; clrscr(); goto en; } goto en; } else { clrscr(); goto lb; } } } //en en: if(m==3) { break; } clrscr(); } f.close(); clrscr();
  38. 38. 35 | P a g e remove("random.dat"); y.open("random.dat",ios::app | ios::out); y.write((char *) &ra,sizeof(ra)); y.close(); strcpy(e.id,c.id); e.ca=anc; strcpy(e.fname,c.fname); strcpy(e.lname,c.lname); result z; y.open("result.dat",ios::in); while(y) { y.read((char *) &z,sizeof(z)); if(strcmp(z.id,e.id)!=0) { f.open("tresult.dat",ios::app | ios::out); f.write((char *) &z,sizeof(z)); f.close(); } } y.close(); remove("result.dat"); rename("tresult.dat","result.dat"); f.open("result.dat",ios::app | ios::out); f.write((char *) &e,sizeof(e)); f.close(); } /*Test result*/ /*Final*/ void testresult() { white(); int re=0; result z; y.open("result.dat",ios::in); while(y) { y.read((char *) &z,sizeof(z)); if(strcmp(z.id,c.id)==0) { re=1; break; } }
  39. 39. 36 | P a g e y.close(); if(re==0) { gotoxy(25,4); cout<<"Result not available"; getch(); return; } clrscr(); for(int i=2;i<=16;i++) { for(int j=25;j<=55;j++) { if(i==2 || i==16 || i==6 || i==14) { gotoxy(j,i); cout<<"-"; } if(i>=3 && i<=15) { if(j==25 || j==55) { gotoxy(j,i); cout<<"|"; } } if(i>=7 && i<=13) { if(j==43) { gotoxy(j,i); cout<<"|"; } } } } gotoxy(28,3); cout<<"Id : "<<c.id; gotoxy(27,5); cout<<"Name : "<<c.fname; // cout<<c.lname; gotoxy(27,7); cout<<"Total Question";
  40. 40. 37 | P a g e gotoxy(48,7); cout<<"5"; gotoxy(27,9); cout<<"Correct answer"; gotoxy(48,9); cout<<z.ca; gotoxy(27,11); cout<<"Total Marks"; gotoxy(48,11); cout<<"50"; gotoxy(27,13); cout<<"Obtain Marks"; gotoxy(48,13); cout<<(z.ca*10); gotoxy(27,15); cout<<"Result : "; if((z.ca*10)>=30) { cout<<"Pass"; } else { textcolor(4); cprintf("Fail"); } gotoxy(27,18); cout<<"Press any key to Back....."; getch(); } /*Front screen*//*Final*/ void front() { white(); gotoxy(30,4); cout<<"Online Exam"; gotoxy(27,7); cout<<"1. Student Panel"; gotoxy(27,9); cout<<"2. Administrator Panel"; gotoxy(27,11); cout<<"3. Exit"; } /*admin login*//*final*/
  41. 41. 38 | P a g e void adminlog() { white(); gotoxy(30,4); cout<<"Log in"; gotoxy(25,6); cout<<"Id : "; cin.getline(b.id,60); gotoxy(19,8); cout<<"Password : "; int sic=-1; while(b.password[sic]!=13) { sic++; b.password[sic]=getch(); cout<<"*"; if(b.password[sic]==8) { cout<<"b bb b"; sic-=2; } } b.password[sic]='0'; // cin.getline(b.password,60); textcolor(4); gotoxy(30,12); cprintf("L"); gotoxy(39,12); cprintf("C"); textcolor(0); gotoxy(31,12); cprintf("ogin"); gotoxy(40,12); cout<<"ancel"; char n; int g=0; wi: n=getch(); if(n=='L' || n=='l') { admin w; f.open("admin.dat",ios::in); while(f)
  42. 42. 39 | P a g e { f.read((char *) &w, sizeof(w)); if(strcmp(b.id,w.id)==0 && strcmp(b.password,w.password)==0) { clrscr(); gotoxy(30,4); cout<<"Welcome Admin"; g++; break; } g=0; if(f==0) { break; } } f.close(); if(g==0 || g=='0') { gotoxy(30,10); cout<<"Id not valid"; delay(1500); main(); } goto en; } else if(n=='C' || n=='c') { main(); } else { goto wi; } en: } /*Delete question*//*Final*/ void dele() { bkl: white(); int delq;
  43. 43. 40 | P a g e gotoxy(25,3); cout<<"Enter Question no. you want to delete"; gotoxy(25,5); cout<<"Enter : "; cin>>delq; int cou=0; exam w; f.open("exam.dat",ios::in); while(f) { f.read((char *) &w,sizeof(w)); if(f==0) { break; } if(delq==w.qn) { cou=1; break; } } f.close(); if(cou==0) { gotoxy(25,9); cout<<"Question not available"; getch(); clrscr(); goto bkl; } textcolor(4); gotoxy(30,7); cprintf("D"); gotoxy(40,7); cprintf("C"); textcolor(0); gotoxy(31,7); cprintf("elete"); gotoxy(41,7); cout<<"ancel"; char n; bk: n=getch();
  44. 44. 41 | P a g e if(n=='d' || n=='D') { exam w; f.open("exam.dat",ios::in); y.open("texam.dat",ios::app | ios::out); while(f) { f.read((char *) &w,sizeof(w)); if(f==0) { break; } if(delq!=w.qn) { y.write((char *) &w,sizeof(w)); } } y.close(); f.close(); remove("exam.dat"); rename("texam.dat","exam.dat"); cou=1; f.open("exam.dat",ios::in); y.open("texam.dat",ios::app | ios::out); while(f) { f.read((char *) &w,sizeof(w)); if(f==0) { break; } w.qn=cou; y.write((char *) &w,sizeof(w)); cou++; } y.close(); f.close(); remove("exam.dat"); rename("texam.dat","exam.dat"); goto en; } else if(n=='c' || n=='C') {
  45. 45. 42 | P a g e goto en; } else { goto bk; } en: } /*Ready to test*/ /*Final*/ void ready() { white(); char re1[50]="You have three minutes to complete your test"; int i=0; gotoxy(21,4); while(re1[i]!='0') { delay(50); cout<<re1[i]; i++; } char re[15]="Ready"; i=0; gotoxy(37,6); while(re[i]!='0') { delay(50); cout<<re[i]; i++; } textcolor(4); gotoxy(33,9); cprintf("Y"); gotoxy(43,9); cprintf("N"); textcolor(0); gotoxy(34,9); cprintf("es"); gotoxy(44,9); cout<<"o"; char n; bk: n=getch();
  46. 46. 43 | P a g e if(n=='y' || n=='Y') { gdv.gdcq=1; goto en; } else if(n=='n' || n=='N') { gdv.gdcq=0; goto en; } else { goto bk; } en: } /*Result process*//*Final*/ void process() { white(); char wt[50]="Result will be process"; int i=0; gotoxy(30,6); while(wt[i]!='0') { delay(50); cout<<wt[i]; i++; } char wt1[20]="Wait few second"; i=0; gotoxy(34,7); while(wt1[i]!='0') { delay(50); cout<<wt1[i]; i++; } for(i=1;i<=12;i++) { delay(600); if(i==4 || i==7 || i==10) {
  47. 47. 44 | P a g e cout<<"b bb b"; } else { cout<<"."; } } } }; }
  48. 48. 45 | P a g e THANK YOU

×