#include<iostream.h>
#include<conio.h>
void cgpa_input();
void main()
{
clrscr();
cgpa_input();
getch();
}
void cgpa_input()
{
int m[15],i,n,mn;
float g[15],total=0,gtotal=0,cgpa;
char ma[15],sc[10][15],sem[15],name[15],year[15],dept[15];
cout<<"\n Enter the student name:";
cin>>name;
cout<<"\n Enter the department:";
cin>>dept;
cout<<"\n Enter the Year of student:";
cin>>year;
cout<<"\n Enter the semester of the student:";
cin>>sem;
cout<<"\n Enter the No. of Subjects:";
cin>>n;
cout<<"\n Enter the grades in (S-E) F-arrear";
for(i=0;i<n;i++)
{
cout<<"\n Enter the subject code,grades in(S-E),grade points:";
cin>>sc[i]>>ma[i]>>g[i];
}
for(i=0;i<n;i++)
{
switch(ma[i])
{
case 'S':
case 's':
m[i]=10;
break;
case 'A':
case 'a':
m[i]=9;
break;
case 'B':
case 'b':
m[i]=8;
break;
case 'C':
case 'c':
m[i]=7;
break;
case 'D':
case 'd':
m[i]=6;
break;
case 'E':
case 'e':
m[i]=5;
break;
case 'F':
case 'f':
mn=0;
break;
}
}
if(mn==0)
{
clrscr();
cout<<"\n\tNAME:"<<name<<"\t\tDEPARTMENT:"<<dept<<endl;
cout<<"\n\tYEAR:"<<year<<"\t\tSEMESTER:"<<sem<<endl;
cout<<"\n Subject code Grade";
for(i=0;i<n;i++)
{
cout<<"\n\t"<<sc[i]<<"\t\t"<<ma[i];
}
cout<<"\n\nCGPA=ARREAR";
}
else
{
clrscr();
cout<<"\n\tNAME:"<<name<<"\t\tDEPARTMENT:"<<dept<<endl;
cout<<"\n\tYEAR:"<<year<<"\t\tSEMESTER:"<<sem<<endl;
cout<<"\n Subject code Grade";
for(i=0;i<n;i++)
{
cout<<"\n\t"<<sc[i]<<"\t\t"<<ma[i];
}
for(i=0;i<n;i++)
{
total=total+(m[i]*g[i]);
}
for(i=0;i<n;i++)
{
gtotal=gtotal+g[i];
}
cgpa=total/gtotal;
cout<<"\n\nCGPA="<<cgpa;
}
}
Output:
Enter the student name:Rajiv Ranjan V
Enter the department:Mechanical
Enter the year of student:4
Enter the semester of the student:7
Enter the No. of Subjects:8
Enter the grades in (S-E) F-arrear
Enter the subject code:701
Enter the grades in (S-E):S
Enter the grade point:3.5
Enter the subject code:702
Enter the grades in (S-E):A
Enter the grade point:3.5
Enter the subject code:703
Enter the grades in (S-E):A
Enter the grade point:3
Enter the subject code:704
Enter the grades in (S-E):B
Enter the grade point:3
Enter the subject code:705
Enter the grades in (S-E):A
Enter the grade point:3
Enter the subject code:706
Enter the grades in (S-E):A
Enter the grade point:3.5
Enter the subject code:711
Enter the grades in (S-E):S
Enter the grade point:1.5
Enter the subject code:712
Enter the grades in (S-E):S
Enter the grade point:1.5
NAME:Rajiv Ranjan V DEPARTMENT:Mechanical
YEAR:4 SEMESTER:7
Subject code Grade
701 S
702 A
703 A
704 B
705 A
706 A
711 S
712 S
CGPA=9.1555555556
Press enter key to exit....
#include<conio.h>
void cgpa_input();
void main()
{
clrscr();
cgpa_input();
getch();
}
void cgpa_input()
{
int m[15],i,n,mn;
float g[15],total=0,gtotal=0,cgpa;
char ma[15],sc[10][15],sem[15],name[15],year[15],dept[15];
cout<<"\n Enter the student name:";
cin>>name;
cout<<"\n Enter the department:";
cin>>dept;
cout<<"\n Enter the Year of student:";
cin>>year;
cout<<"\n Enter the semester of the student:";
cin>>sem;
cout<<"\n Enter the No. of Subjects:";
cin>>n;
cout<<"\n Enter the grades in (S-E) F-arrear";
for(i=0;i<n;i++)
{
cout<<"\n Enter the subject code,grades in(S-E),grade points:";
cin>>sc[i]>>ma[i]>>g[i];
}
for(i=0;i<n;i++)
{
switch(ma[i])
{
case 'S':
case 's':
m[i]=10;
break;
case 'A':
case 'a':
m[i]=9;
break;
case 'B':
case 'b':
m[i]=8;
break;
case 'C':
case 'c':
m[i]=7;
break;
case 'D':
case 'd':
m[i]=6;
break;
case 'E':
case 'e':
m[i]=5;
break;
case 'F':
case 'f':
mn=0;
break;
}
}
if(mn==0)
{
clrscr();
cout<<"\n\tNAME:"<<name<<"\t\tDEPARTMENT:"<<dept<<endl;
cout<<"\n\tYEAR:"<<year<<"\t\tSEMESTER:"<<sem<<endl;
cout<<"\n Subject code Grade";
for(i=0;i<n;i++)
{
cout<<"\n\t"<<sc[i]<<"\t\t"<<ma[i];
}
cout<<"\n\nCGPA=ARREAR";
}
else
{
clrscr();
cout<<"\n\tNAME:"<<name<<"\t\tDEPARTMENT:"<<dept<<endl;
cout<<"\n\tYEAR:"<<year<<"\t\tSEMESTER:"<<sem<<endl;
cout<<"\n Subject code Grade";
for(i=0;i<n;i++)
{
cout<<"\n\t"<<sc[i]<<"\t\t"<<ma[i];
}
for(i=0;i<n;i++)
{
total=total+(m[i]*g[i]);
}
for(i=0;i<n;i++)
{
gtotal=gtotal+g[i];
}
cgpa=total/gtotal;
cout<<"\n\nCGPA="<<cgpa;
}
}
Output:
Enter the student name:Rajiv Ranjan V
Enter the department:Mechanical
Enter the year of student:4
Enter the semester of the student:7
Enter the No. of Subjects:8
Enter the grades in (S-E) F-arrear
Enter the subject code:701
Enter the grades in (S-E):S
Enter the grade point:3.5
Enter the subject code:702
Enter the grades in (S-E):A
Enter the grade point:3.5
Enter the subject code:703
Enter the grades in (S-E):A
Enter the grade point:3
Enter the subject code:704
Enter the grades in (S-E):B
Enter the grade point:3
Enter the subject code:705
Enter the grades in (S-E):A
Enter the grade point:3
Enter the subject code:706
Enter the grades in (S-E):A
Enter the grade point:3.5
Enter the subject code:711
Enter the grades in (S-E):S
Enter the grade point:1.5
Enter the subject code:712
Enter the grades in (S-E):S
Enter the grade point:1.5
NAME:Rajiv Ranjan V DEPARTMENT:Mechanical
YEAR:4 SEMESTER:7
Subject code Grade
701 S
702 A
703 A
704 B
705 A
706 A
711 S
712 S
CGPA=9.1555555556
Press enter key to exit....
0 comments:
Post a Comment