728x90 AdSpace

Latest Article

C C++ Program to read mark sheet of a student and prints the GPA.





Program to read mark sheet of a student and prints the GPA in C C++ Programming Language Code Example assignment online
     

#include<stdio.h>
#include<conio.h>
void outerborder(void);
void innerborder(void);
void sline(void);
void dline(void);
void printresult(void);
void readresult(void);
void grade(int);
void gpa(float);
void printline(int,int);
void main(void)
{
clrscr();
outerborder();
innerborder();
printresult();
readresult();
getch();
}
void dline(void)
{
int i;
for(i=1; i<=78; i++)
printf("\xCD");
}
void sline(void)
{
int k;
for(k=1; k<=70; k++)
printf("\xC4");
}
void outerborder (void)
{
int a=80,b=2,j;
printf("\xC9");
dline();
printf("\xBB");
for(j=1; j<=22; j++)
printf("\xBA\n");
printf("\xC8");
dline();
gotoxy(a, b);
for(j=1; j<=23; j++)
{
printf("\xBA");
gotoxy(a, b++);
}
printf("\xBC");
}
void innerborder(void)
{
int e=5,f=5,l,m,i;
gotoxy(4, 5);
printf("\xDA");
sline();
printf("\xBF");
l=4,m=6;
gotoxy(l,m);
for(i=1;i<=14;i++)
{
if((i%2)!=0)
{
printf("\xC3");
gotoxy(l,m++);
}
else
{
printf("\xB3");
gotoxy(l,m++);
}
}
printf("\xC0");
sline();
printf("\xD9");
l=75,m=6;
gotoxy(l,m);
for(i=1;i<=14;i++)
{
if((i%2)!=0)
{
printf("\xB4");
gotoxy(l,m++);
}
else
{
printf("\xB3");
gotoxy(l,m++);
}
}
for(i=1; i<8; i++)
{
gotoxy(e,f+=2);
sline();
}
gotoxy(15,5);
printf("\xC2");
l=15,m=6;
gotoxy(l,m);
printline(l,m);
printf("\xC1");
gotoxy(42,5);
printf("\xC2");
l=42, m=6;
gotoxy(l, m);
printline(l,m);
printf("\xC1");
gotoxy(53,5);
printf("\xC2");
l=53, m=6;
gotoxy(l,m);
printline(l,m);
printf("\xC1");
gotoxy(64,5);
printf("\xC2");
l=64, m=6;
gotoxy(l,m);
printline(l,m);
printf("\xC1");
}
void printresult(void)
{
int u=7, v=8;
gotoxy(3,2);
printf("Registeration No. ____-CS/BS/2003");
gotoxy(3,3);
printf("Student's Name: ___________________");
gotoxy(8,6);
printf("CODE");
gotoxy(44,6);
printf("MID-TERM");
gotoxy(55,6);
printf("TERMINAL");
gotoxy(67,6);
printf("GRADE");
gotoxy(u,v);
printf("CS 502");
gotoxy(u,v+=2);
printf("AM 503");
gotoxy(u,v+=2);
printf("AM 504");
gotoxy(u,v+=2);
printf("UR 104");
gotoxy(u,v+=2);
printf("UR 108");
gotoxy(u,v+=2);
printf("UR 109");
gotoxy(22,6);
printf("COURSE TITLE");
gotoxy(18,8);
printf("Programming Language-I");
gotoxy(18,10);
printf("Multi-Variable Calculus");
gotoxy(17,12);
printf("Statistics & Probability");
gotoxy(19,14);
printf("Functional Arabic-II");
gotoxy(19,16);
printf("Functional English-II");
gotoxy(22,18);
printf("Islamic Studies");
gotoxy(65,21);
printf("GPA: ___");
}
void readresult(void)
{
int reg,a=68,b=8,l=47,sum,total=0,m=8,n=57,o=8,c1,c2;
float avg;
char nam;
gotoxy(21,2);
scanf("%d", &reg);
gotoxy(19,3);
while(nam != '\r')
nam=getche();
for(int i=1; i<=6;i++)
{
gotoxy(l,m);
scanf("%d", &c1);
while(c1>40 || c1<0)
{
gotoxy(l,m);
printf("      ");
gotoxy(l,m);
scanf("%d", &c1);
}
gotoxy(n,o);
scanf("%d", &c2);
while(c2>60 || c2<0)
{
gotoxy(n,o);
printf("     ");
gotoxy(n,o);
scanf("%d", &c2);
}
sum=c1+c2;
gotoxy(a,b);
grade(sum);
total=total+sum;
m=m+=2;
o=o+=2;
b=b+=2;
}
avg=total/6;
gotoxy(70,21);
gpa(avg);
}
void grade(int sum)
{
if(sum>100 || sum<0)
printf("WRONG MARKS");
else if(sum>=80)
printf("A");
else if(sum<80 && sum>=75)
printf("B+");
else if(sum<75 && sum>=70)
printf("B");
else if(sum<70 && sum>=65)
printf("C+");
else if(sum<65 && sum>=60)
printf("C");
else if(sum<60)
printf("F");
}
void gpa(float avg)
{
if(avg<=100 && avg>=80)
printf("4.0");
else if(avg<80 && avg>=75)
printf("3.5");
else if(avg<75 && avg>=70)
printf("3.0");
else if(avg<70 && avg>=65)
printf("2.5");
else if(avg<65 && avg>=60)
printf("2.0");
else
printf("NULL");
}
void printline(int l, int m)
{
for(int i=1;i<=14;i++)
{
if((i%2)!=0)
{
printf("\xC5");
gotoxy(l,m++);
}
else
{
printf("\xB3");
gotoxy(l,m++);
}
}
}
no image
  • Title : C C++ Program to read mark sheet of a student and prints the GPA.
  • Posted by :
  • Date : 03:53
  • Labels :





  • Blogger Comments
  • Facebook Comments

0 comments:

Post a Comment

Top