1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
|
//program to compile a student academic report
#include<iostream>
using namespace std;
void studentDetails(string & name,string & surname,string & schoolname)
{
cout<<"enter your name :";
cin>>name;
cout<<"enter your surname:";
cin>>surname;
cout<<"enter the name of your school:";
cin>>schoolname;
}
void getMarks (float&engMark,float&matMark,float&LOMark,float&HisMark,float&CLMark,float&GeoMark)
{
do{
cout << "Enter your marks: ";
cin >> engMark;}
while(engMark<0 || engMark >100);
do{
cout << "Enter your marks: ";
cin >> matMark;}
while(matMark<0 || matMark >100);
do{
cout << "Enter your marks: ";
cin >> LOMark;}
while(LOMark<0 || LOMark >100);
do{
cout << "Enter your marks: ";
cin >> HisMark;}
while(HisMark<0 || HisMark >100);
do{
cout << "Enter your marks: ";
cin >> CLMark;}
while(CLMark<0 || CLMark >100);
do{
cout << "Enter your marks: ";
cin >> GeoMark;}
while(GeoMark<0 || GeoMark >100);
}
float averageyearmark(float engMark1,float matMark1,float LOMark1,float HisMark1,float CLMark1,float GeoMark1)
{
return (engMark1+matMark1+LOMark1+HisMark1+CLMark1+GeoMark1)/6;
}
void minMax(float engMark1,float matMark1,float LOMark1,float HisMark1,float CLMark1,float GeoMark1, float &highest, float &lowest)
{
highest =engMark1;
if (matMark1>highest)
highest=matMark1;
if (LOMark1>highest)
highest=LOMark1;
if (HisMark1>highest)
highest=HisMark1;
if (CLMark1>highest)
highest=CLMark1;
if (GeoMark1>highest)
highest=GeoMark1;
lowest =engMark1;
if (matMark1<lowest)
lowest=matMark1;
if (LOMark1<lowest)
lowest=LOMark1;
if (HisMark1<lowest)
lowest=HisMark1;
if (CLMark1<lowest)
lowest=CLMark1;
if (GeoMark1<lowest)
lowest=GeoMark1;
}
int main()
{
string name1,surname1,schoolname1;
float engMark,matMark,LOMark,HisMark,CLMark,GeoMark,average,highest1,lowest1;
studentDetails(name1,surname1,schoolname1);
getMarks(engMark,matMark,LOMark,HisMark,CLMark,GeoMark);
cout<<" marks English mark:"<<engMark<< "Mathematics mark:"<<matMark<< "Life Orientation Mark"<<LOMark<<"History Mark:"<<HisMark<<"Computer Literacy Mark :"<<CLMark<<"Geography Mark"<<GeoMark<<endl;
average=averageyearmark(engMark,matMark,LOMark,HisMark,CLMark,GeoMark);
cout<<"average"<<average<<endl;
minMax(engMark,matMark,LOMark,HisMark,CLMark,GeoMark, highest1, lowest1);
cout<<"The highest mark is:"<<highest1<<"\nThe lowest mark is:"<<lowest1<<endl;
return 0;
}
|