Transcript
Page 1: COMPUTER SCIENCE INVESTIGATORY PROJECT

Page | 1

CERTIFICATE OF AUTHENCITY

THIS IS TO CERTIFY THAT MASTER NIKHIL DWIVEDI OF CLASS XII-A OF KENDRIYA VIDYALAYA ASC CENTER(S) HAS SUCCESSFULLY CARRIED OUT THE INVESTIGATORY PROJECT ENTITLED “STUDENT REPORT CARD” UNDER THE SUPERVISION OF COMPUTER SCIENCE TEACHER MRS B. SHARADA FOR THE ACADEMIC YEAR 2016-2017. ALL THE WORKS RELATED TO THE PROJECT IS DONE BY THE CANDIDATE HIMSELF. THE APPROACH TOWARDS THE SUBJECT HAS BEEN SINCERE AND SCIENTIFIC.

ROLL NO- DATE-

Signature (Subject teacher) Signature (Examiner)

Page 2: COMPUTER SCIENCE INVESTIGATORY PROJECT

Page | 2

ACKNOWLEDGEMENT

I feel proud to present my Investigatory project in Computer Science on the topic “STUDENT REPORT CARD”. This project wouldn’t have been feasible without the proper and rigorous guidance of my Computer Science teacher who guided me throughout this project in every possible way. An investigatory project involves various difficult codings which have to be carried out by the student to obtain the observations and conclude the report on a meaningful note. Rigorous hard work has been put in this project to ensure that it proves to be the best. I hope that this project will prove to be a breeding ground for the next generation of students and will guide them in every possible way.

Page 3: COMPUTER SCIENCE INVESTIGATORY PROJECT

Page | 3

INDEX

Introduction Header files used Working C++ coding Output Screenshots Bibliography

Page 4: COMPUTER SCIENCE INVESTIGATORY PROJECT

Page | 4

INTRODUCTION C++ is a general-purpose programming language. It has imperative, object-oriented andgeneric programming features, while also providing facilities for low-level memory manipulation. It was designed with a bias toward system programming and embedded, resource-constrained and large systems, with performance, efficiency and flexibility of use as its design highlights.[5] C++ has also been found useful in many other contexts, with key strengths being software infrastructure and resource-constrained applications,[5] including desktop applications, servers (e.g. e-commerce,web search or SQL servers), and performance-critical applications (e.g. telephone switches or space probes).[6] C++ is a compiled language, with implementations of it available on many platforms and provided by various organizations, including the Free Software Foundation (FSF's GCC), LLVM, Microsoft, Intel and IBM. C++ is standardized by the International Organization for Standardization (ISO), with the latest standard version ratified and published by ISO in December 2014 as ISO/IEC 14882:2014 (informally known as C++14).[7] The C++ programming language was initially standardized in 1998 as ISO/IEC 14882:1998, which was then amended by the C++03, ISO/IEC 14882:2003, standard. The current C++14 standard supersedes these and C++11, with new features and an enlarged standard library. Before the initial standardization in 1998, C++ was developed by Bjarne Stroustrup at Bell Labs since 1979, as an extension of the C language as he wanted an efficient and flexible language similar

Page 5: COMPUTER SCIENCE INVESTIGATORY PROJECT

Page | 5

to C, which also provided high-level features for program organization. Many other programming languages have been influenced by C++, including C#, D, Java, and newer versions of C (after 1998).

Page 6: COMPUTER SCIENCE INVESTIGATORY PROJECT

Page | 6

HEADER FILES USED

#include<fstream.h> #include<iomanip.h> #include<stdio.h> #include<conio.h> #include<string.h>

Page 7: COMPUTER SCIENCE INVESTIGATORY PROJECT

Page | 7

WORKING

This program is designed to create a Student Report Card. It provides the following option to the users: Shows Class Result Shows Student Report Card Create Student Record Display all Student Record Search Student Record Modify Student Record Delete Student record

Page 8: COMPUTER SCIENCE INVESTIGATORY PROJECT

Page | 8

PROGRAM CODING #include<fstream.h> #include<iomanip.h> #include<stdio.h> #include<conio.h> #include<string.h> class student { int rollno; char name[50],password,kvmeg; int p_marks, c_marks, m_marks, e_marks, cs_marks; float per; char grade; void calculate(); public: void getdata(); void showdata(); void show_tabular();

Page 9: COMPUTER SCIENCE INVESTIGATORY PROJECT

Page | 9

int retrollno(); int roll() { return(rollno); } }; void student::calculate() { per=(p_marks+c_marks+m_marks+e_marks+cs_marks)/5; if(per>=60) grade='A'; else if(per>=50) grade='B'; else if(per>=33) grade='C'; else grade='F'; }

Page 10: COMPUTER SCIENCE INVESTIGATORY PROJECT

Page | 10

void student::getdata() { int r; student s; cout<<"\n enter the roll no. of the student "; cin>>r; fstream sid("student.dat",ios::binary|ios::in); while(!sid.eof()) { sid.read((char*)&s,sizeof(student)); if(s.roll()==r) { cout<<"This Roll Number Already Exists"; goto last; } } rollno=r; sid.close(); cout<<"\n\n enter the name of student "; gets(name); cout<<"\n enter the marks obtained in physics out of 100: ";

Page 11: COMPUTER SCIENCE INVESTIGATORY PROJECT

Page | 11

cin>>p_marks; cout<<"\n enter the marks obtained in chemistry out of 100: "; cin>>c_marks; cout<<"\n enter the marks obtained in english out of 100: "; cin>>e_marks; cout<<"\n enter the marks obtained in maths out of 100: "; cin>>m_marks; cout<<"\n enter the marks obtained in computer science out of 100: "; cin>>cs_marks; calculate(); cout<<"Record Created "; last: } void student::showdata() { cout<<"\n roll no of student: "<<rollno; cout<<"\n name of student: "<<name; cout<<"\n marks in physics: "<<p_marks;

Page 12: COMPUTER SCIENCE INVESTIGATORY PROJECT

Page | 12

cout<<"\n marks in chemistry: "<<c_marks; cout<<"\n marks in english: "<<e_marks; cout<<"\n marks in maths: "<<m_marks; cout<<"\n marks in computer science: "<<cs_marks; cout<<"\n percentage of student is: "<<per; cout<<"\n grade of student is; "<<grade; getch(); } void student::show_tabular() { cout<<rollno<<"\t"; for(int sd=0;sd<strlen(name)&&sd<15;sd++) cout<<name[sd]; if(strlen(name)<=6) cout<<"\t"; cout<<"\t"<<p_marks<<"\t"<<c_marks<<"\t"<<e_marks<<"\t"<<m_marks<<"\t"<<cs_marks<<"\t"<<per<<"\t"<<grade<<endl; } int student::retrollno() {

Page 13: COMPUTER SCIENCE INVESTIGATORY PROJECT

Page | 13

return rollno; } void write_student(); void display_all(); void display_sp(int); void modify_student(int); void delete_student(int); void class_result(); void result(); void intro(); void entry_menu(); int main() { s: char ch; cout.setf(ios::fixed|ios::showpoint); cout<<setprecision(2); clrscr(); intro(); do {

Page 14: COMPUTER SCIENCE INVESTIGATORY PROJECT

Page | 14

clrscr(); cout<<"\n\n\n\t MAIN MENU "; cout<<"\n\n\t01. RESULT MENU"; cout<<"\n\n\t02. ENTRY/EDIT MENU"; cout<<"\n\n\t03. CLEAR ALL RECORDS\n\n\t04.Exit"; cout<<"\n\n\tPLEASE SELECT YOUR OPTION(1-3)"; cin>>ch; clrscr(); switch(ch) { case '1': result(); break; case '2': entry_menu(); break; case '3':remove("student.dat"); cout<<"\n\n\tAll Records Deleted"; getch(); break;

Page 15: COMPUTER SCIENCE INVESTIGATORY PROJECT

Page | 15

case '4': break; default:cout<<"\a"; } }while(ch!='4'); return 0; } void write_student() { student st; ofstream outfile; outfile.open("student.dat",ios::binary|ios::app); st.getdata(); outfile.write((char*)&st, sizeof(student)); cin.ignore(); getch(); } void display_all() { student st;

Page 16: COMPUTER SCIENCE INVESTIGATORY PROJECT

Page | 16

ifstream infile; infile.open("student.dat",ios::binary); if(!infile) { cout<<" file could not be open !!press any key..."; getch(); return; } cout<<"\n\n\n\tdisplay all record\n\n"; while(!infile.eof()) { infile.read((char*)&st, sizeof(student)); if(infile.eof()||!infile) break; st.showdata(); cout<<"\n\n=================\n\n"; } }

Page 17: COMPUTER SCIENCE INVESTIGATORY PROJECT

Page | 17

void display_sp(int n) { student st; ifstream infile; infile.open("student.dat",ios::binary); if(!infile) { cout<<" file could not be open !! press any key..."; getch(); return; } int flag=0; while(infile.read((char*)&st, sizeof(student))) { if(st.retrollno()==n) { st.showdata(); flag=1;

Page 18: COMPUTER SCIENCE INVESTIGATORY PROJECT

Page | 18

} } infile.close(); if(flag==0) cout<<"\n\nrecord does not exist "; getch(); } void modify_student(int n) { int found=0; student st; fstream file; file.open("student.dat",ios::binary|ios::in|ios::out); if(!file) { cout<<" file could not be open !! press any key..."; getch(); }

Page 19: COMPUTER SCIENCE INVESTIGATORY PROJECT

Page | 19

while(file.read((char*)&st, sizeof(student))&&found==0) { if(st.retrollno()==n) { st.showdata(); cout<<"\n\nplease enter the new details of student"<<endl; st.getdata(); int pos=(-1)*sizeof(st); file.seekp(pos,ios::cur); file.write((char*)&st, sizeof(student)); cout<<"\n\n\t record updates "; found=-1; } } file.close(); if(found==0) cout<<"\n\n record not found "; getch();

Page 20: COMPUTER SCIENCE INVESTIGATORY PROJECT

Page | 20

} void delete_student(int n) { int flag=0; student st; ifstream infile; infile.open("student.dat",ios::binary); if(!infile) { cout<<"file could not be open !! press any key...."; getch(); return; } ofstream outfile; outfile.open("temp.dat",ios::out|ios::binary); infile.seekg(0,ios::beg); while(!infile.eof()) {

Page 21: COMPUTER SCIENCE INVESTIGATORY PROJECT

Page | 21

infile.read((char*)&st, sizeof(student)); if(infile.eof()) break; if(st.retrollno()!=n) { outfile.write((char*)&st,sizeof(student)); } else if(st.retrollno()==n) { flag=1; } } outfile.close(); infile.close(); remove("student.dat"); rename("temp.dat","student.dat"); if(flag==1) cout<<"\n\n\trecord deleted..."; else cout<<"\n\nNo Record Found ";

Page 22: COMPUTER SCIENCE INVESTIGATORY PROJECT

Page | 22

getch(); } void class_result() { student st; ifstream infile; infile.open("student.dat",ios::binary); if(!infile) { cout<<"file could not be open !! press any key..."; getch(); return; } cout<<"\n\n\tall students result \n\n"; cout<<"================================================================================"; cout<<"|R.No\t|Name\t\t|Phy\t|Che\t|Mat\t|Eng\t|CS\t|%age\t|Grade"<<endl;

Page 23: COMPUTER SCIENCE INVESTIGATORY PROJECT

Page | 23

cout<<"================================================================================"; while(infile.read((char*)&st, sizeof(student))) { st.show_tabular(); } cout<<"================================================================================\n"; getch(); infile.close(); } void result() { char ch; int rno;

Page 24: COMPUTER SCIENCE INVESTIGATORY PROJECT

Page | 24

cout<<"\n\n\tresult menu"; cout<<"\n\n\t1. class result"; cout<<"\n\n\t2. student report card"; cout<<"\n\n\t3. back to main menu"; cout<<"\n\n\tenter your choice(1-3).."; cin>>ch; switch(ch) { case '1': class_result(); break; case '2': cout<<"\n\n\tenter rollno of student: "; cin>>rno; display_sp(rno); break; case '3': break; default: cout<<"\a"; } } void intro() {

Page 25: COMPUTER SCIENCE INVESTIGATORY PROJECT

Page | 25

cout<<" COMPUTER SCIENCE INVESTIGATORY PROJECT"; cout<<"\n\n\t STUDENT REPORT CARD "; cout<<"\n\n\t MADE BY: NIKHIL DWIVEDI, XII 'A', KV ASC BANGALORE"; cout<<"\n\n\t UNDER THE GUIDENCE OF: MRS. B. SHARDA"; getch(); } void entry_menu() { char ch; int num; clrscr(); cout<<"\n\n\t entry menu"; cout<<"\n\n\t1.create student record"; cout<<"\n\n\t2. display all student records";

Page 26: COMPUTER SCIENCE INVESTIGATORY PROJECT

Page | 26

cout<<"\n\n\t3. search student record"; cout<<"\n\n\t4. modify student record"; cout<<"\n\n\t5.delete student record"; cout<<"\n\n\t6. back to main menu"; cout<<"\n\n\tplease enter your choice"; cin>>ch; switch(ch) { case '1': write_student(); break; case '2': display_all(); break; case '3': cout<<"\\n\tplease enter the roll no";

cin>>num; display_sp(num);

break; case '4': cout<<"\n\n\tplease enter the roll no";

cin>>num; modify_student(num);

break; case '5': cout<<"\n\n\tplease enter the roll no";

Page 27: COMPUTER SCIENCE INVESTIGATORY PROJECT

Page | 27

cin>>num; delete_student(num); break; case '6': break; dafault: cout<<"\a"; entry_menu();

} }

Page 28: COMPUTER SCIENCE INVESTIGATORY PROJECT

Page | 28

SCREENSHOTS

Page 29: COMPUTER SCIENCE INVESTIGATORY PROJECT

Page | 29

Page 30: COMPUTER SCIENCE INVESTIGATORY PROJECT

Page | 30

Page 31: COMPUTER SCIENCE INVESTIGATORY PROJECT

Page | 31

Page 32: COMPUTER SCIENCE INVESTIGATORY PROJECT

Page | 32

Page 33: COMPUTER SCIENCE INVESTIGATORY PROJECT

Page | 33

Page 34: COMPUTER SCIENCE INVESTIGATORY PROJECT

Page | 34

BIBLIOGRAPHY

Getting started with C++ by Sumita Arora www.slideshare.com en.wikipedia.org www.google.com www.icbse.in


Recommended