Transcript
Page 1: Computer Science Investigatory Project Class 11/12

-SHWETA GUPTA

Page 2: Computer Science Investigatory Project Class 11/12

Introduction The following program creates a

data type student which includes

the following members:

1. Name

2. Roll no.

3. Marks in 5 subjects

4. Total

5. Average

6. Grade

It arranges the students in

ascending order of total marks

obtained.

It also finds the subject

toppers and overall topper.

Page 3: Computer Science Investigatory Project Class 11/12

Certificate This is to certify that

Shweta Gupta studying in

class 11 C has successfully

completed the computer

science assignment for the

year 2014-15.

Mrs. Aruna D. Ekanath

(PGT [Comp. Sci])

Mrs. Nutan Punj

(Principal)

Page 4: Computer Science Investigatory Project Class 11/12

Acknowledgement

Firstly,I would like to

thank our Principal Mrs.

Nutan Punj for giving me

the opportunity to make

this project.

I express my gratitude to

my teacher Mrs. Aruna D.

Ekanath (PGT [Comp. Sci.])

for helping, guiding and

motivating me throughout

the course of this project.

Page 5: Computer Science Investigatory Project Class 11/12

Index S.NO. TOPIC PAGE

NO.

1. ACKNOWLEDGEMENT 1

2. CERTIFICATES 2

3. INTRODUCTION 6

4. SYSTEM

REQUIREMENTS

7

5. SALIENT

FEATURES

8

6. CODE 9

7. OUTPUT 15

8. SCOPE OF

IMPROVEMENT

19

9. BIBLIOGRAPHY 20

Page 6: Computer Science Investigatory Project Class 11/12

SALIENT FEATURES The program is compact.

The program is edited

for errors.

The program can be run

on many

platforms.

The program is

structural.

The program is user

friendly.

Page 7: Computer Science Investigatory Project Class 11/12

SYSTEM REQUIREMENTS Main processor:

Pentium III and

above.

Hard disk: 1GB.

RAM: 1GB.

Operating system:

Windows XP and

above.

Compiler: Turbo

C++/Dev C++/Code

blocks etc.

Language: C++.

Page 8: Computer Science Investigatory Project Class 11/12

SCOPE OF IMPROVEMENT The program can be

made simpler.

Comments can be used

in the program.

The statements in the

program can be

indented.

Blank lines and blank

spaces can be used in

the program.

Page 9: Computer Science Investigatory Project Class 11/12

CODE

#include<iostream.h>

#include<conio.h>

int n;

struct student

{

char name[20];

int rollno;

int marks[5];

int total;

int average;

char grade;

};

int calctotal(student s1)

{

int i,sum=0;

for(i=0;i<5;i++)

Page 10: Computer Science Investigatory Project Class 11/12

{

sum+=s1.marks[i];

}

return sum;

}

int calcavg(student s1)

{

int avg=s1.total/5;

return avg;

}

char calcgrade(student s1)

{

if(s1.total>400)

return 'A';

else if(s1.total>300)

return 'B';

else if(s1.total>200)

return 'C';

else if(s1.total>100)

Page 11: Computer Science Investigatory Project Class 11/12

return 'D';

else

return 'E';

}

int main()

{

clrscr();

student s[20],tmp;

int

i,j,k,q,z,index[5],max[5]={0,0,0,0,0};

cout<<"Enter the number of

students:"<<endl;

cin>>n;

for(i=0;i<n;i++)

{

cout<<"Enter the details of

student"<<i+1<<"\n";

cout<<"Name:";

cin>>s[i].name;

cout<<"Roll number:";

Page 12: Computer Science Investigatory Project Class 11/12

cin>>s[i].rollno;

cout<<"Marks:-"<<endl;

for(j=0;j<5;j++)

{

cout<<"Subject"<<j+1<<":";

cin>>s[i].marks[j];

}

s[i].total=calctotal(s[i]);

s[i].average=calcavg(s[i]);

s[i].grade=calcgrade(s[i]);

}

for(i=0;i<n;i++)

{

for(k=0;k<5;k++)

{

if(s[i].marks[k]>max[k])

{

max[k]=s[i].marks[k];

index[k]=i;

}

}

Page 13: Computer Science Investigatory Project Class 11/12

}

for(j=0;j<n-1;j++)

for(i=0;i<n-1-j;i++)

{

if(s[i].total<s[i+1].total)

{

tmp=s[i];

s[i]=s[i+1];

s[i+1]=tmp;

}

}

cout<<"The sorted list is:-\n";

for(q=0;q<n;q++)

{

cout<<"Student"<<q+1<<"details:\n";

cout<<"Name:"<<s[q].name<<endl;

cout<<"Roll

number:"<<s[q].rollno<<endl;

cout<<"Marks attained:-\n";

for(z=0;z<5;z++)

Page 14: Computer Science Investigatory Project Class 11/12

cout<<"Subject"<<z+1<<":"<<s[q].marks[

z]<<endl;

cout<<"Total="<<calctotal(s[q])<<endl;

cout<<"Average="<<calcavg(s[q])<<endl;

cout<<"Grade="<<calcgrade(s[q])<<endl;

}

cout<<"The toppers are:-"<<endl;

for(i=0;i<5;i++)

{

cout<<"Subject"<<i+1<<":";

cout<<s[index[i]].name;

cout<<endl;

}

cout<<"The overall topper is

"<<s[0].name<<endl;

getch();

return 0;}

OUTPUT

Page 15: Computer Science Investigatory Project Class 11/12
Page 16: Computer Science Investigatory Project Class 11/12
Page 17: Computer Science Investigatory Project Class 11/12
Page 18: Computer Science Investigatory Project Class 11/12
Page 19: Computer Science Investigatory Project Class 11/12

Bibliography 1. www.google.com

2. www.wikipedia.com

3. Encyclopedia

Britannica.

4. Computer science

with C++ by Sumita

Arora for class 11.