answersLogoWhite

0


Best Answer

#include <stdio.h>

void main()

{

int num,num1,num2, cal;

num=cal=0;

char grade1=cal=0,grade2=cal=0;

printf("\n Enter the number of subjects taken in Spring Semester:");

scanf("%d", &num);

fflush(stdin);//

if(grade1==4){

printf("\n\nEnter the Math Grade(A,B,C): %c",grade1);

do{

printf("\ngrade1=");

scanf("%d",&cal);

}

else if(

printf("\nError!\n\n");

}while(1);

printf("\nEnter the Math Credit hours(1~3):");

num1 = getchar();

grade1=4;

}

else if(grade2==3){

grade2=3;

}

printf("\nEnter the Math Grade(A,B,C):\n");

scanf("%c",&grade1);

printf("Enter the Physics Grade(A,B,C):");

grade2 = getchar();

printf("\nEnter the Physics Credit hours(1~3):");

num2 = getchar();

printf("\nMath Credit hours: %d",num1);

printf("\nPhysics Grade: %c",grade2);

printf("\nPhysics Credit hours:%d\n",num2);

printf("\n <Math Credit hours> \n");

do{

printf("\n 1 + 1 = ");

scanf("%d", &cal);

}while(cal != 3);

printf("\n Error!\n\n");

}

printf("\n <Physics Credit hours> \n");

do{

printf("\n 4 - 1 = ");

scanf("%d", &cal);

}while(cal != 3);

printf("\n Error!\n");

}

printf("\n The End.\n");

system("pause");

}

User Avatar

Wiki User

11y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

11y ago

#include

#include

#include

int j,sem_amik;

int ckredit;

double cgpa,tot_cgpa;

char name[30];

long long int ic,studentid;

int main(int argc , char *argv[])

{

FILE *output = fopen("myfile.txt","w");

printf("Your name : ");

scanf(" %[^\n]",name);

getchar();

printf("IC Number : ");

scanf("%lli",&ic);

printf("Student ID : ");

scanf("%lli",&studentid);

printf("\n\n");

printf("How many sem taken : ");

scanf("%i",&sem_amik);

for(j=0;j

{

struct subject

{

char kod[9];

char name[30];

int kredit;

char grade[3];

double point;

};

struct subject subj[7];

int totKredit = 0;

double totPoint = 0;

double gpa;

int bil,i;

printf("Semester %i \n",j+1);

printf("Your subject this semester <4-7> : ");

scanf("%i",&bil);

printf("\n\n");

for(i=0;i

{

printf("%i.",i+1);

printf(" Code subject : ");

scanf(" %s",subj[i].kod);

printf(" Subject name : ");

scanf(" %[^\n]",subj[i].name);

getchar();

printf(" Subject credit : ");

scanf("%i",&subj[i].kredit);

printf(" Grade : ");

scanf(" %s",subj[i].grade);

printf("\n");

if(strcmp(subj[i].grade,"A")==0)

subj[i].point = 4.0 * subj[i].kredit;

else if(strcmp(subj[i].grade,"A-")==0)

subj[i].point = 3.67 * subj[i].kredit;

else if(strcmp(subj[i].grade,"B+")==0)

subj[i].point = 3.33 * subj[i].kredit;

else if(strcmp(subj[i].grade,"B")==0)

subj[i].point = 3.0 * subj[i].kredit;

else if(strcmp(subj[i].grade,"B-")==0)

subj[i].point = 2.67 * subj[i].kredit;

else if(strcmp(subj[i].grade,"C+")==0)

subj[i].point = 2.33 * subj[i].kredit;

else if(strcmp(subj[i].grade,"C")==0)

subj[i].point = 2.00 * subj[i].kredit;

else if(strcmp(subj[i].grade,"D")==0)

subj[i].point = 1.0 * subj[i].kredit;

else

subj[i].point = 0;

totKredit += subj[i].kredit;

totPoint += subj[i].point;

};

gpa = totPoint/totKredit;

system("clear");

fprintf(output,"Semester %i \n",j+1);

fprintf(output, "Name : %s \n",name);

fprintf(output,"IC number : %lli \n",ic);

fprintf(output,"Student ID : %lli \n\n",studentid);

fprintf(output,"Bil Kod Name Kredit Grade Point\n");

fprintf(output,"-----------------------------------------------------------------");

fprintf(output,"\n\n");

for(i=0;i

{

fprintf(output,"%2i ",i+1);

fprintf(output,"%-8s ",subj[i].kod);

fprintf(output,"%-30s ",subj[i].name);

fprintf(output,"%i ",subj[i].kredit);

fprintf(output,"%-2s ",subj[i].grade);

fprintf(output,"%-5.2lf\n",subj[i].point);

};

fprintf(output,"\n");

fprintf(output,"Total kredit taken : %i \n",totKredit);

fprintf(output,"Total point obtained : %.2lf \n\n",totPoint);

fprintf(output,"Your GPA for this semester : %.2lf\n",gpa);

fprintf(output,"-----------------------------------------------------------------\n\n\n");


cgpa += totPoint;

ckredit += totKredit;

}

tot_cgpa = cgpa/ckredit;

fprintf(output,"Cumulutive credit hour is : %i \n",ckredit);

fprintf(output,"Cumulutive total point is : %.2lf \n",cgpa);

fprintf(output,"\n\nTotal CGPA for %i semester you taken is %.2lf\n",sem_amik,tot_cgpa);

}


//all output will be display at myfile.txt

//Note: the cgpa calculation method may vary in different colleges.

This answer is:
User Avatar

User Avatar

Wiki User

10y ago

CGPA is calculated the same as GPA. Whereas GPA covers one academic term (whether semester, trimester or quadmester), CGPA covers all academic terms.

To calculate the GPA, take the sum of the products for the term and divide by the total credit hours for that term.

To calculate the CGPA, take the sum of the products for all terms and divide by the total credit hours for those terms.

The product is the quality points for each subject multiplied by the credit hours for that subject.

Quality points are determined by the grade (A+, A, A-, B+, etc) while the grade is determined by the percentage mark. How the grades and quality points are determined from the mark can vary from institution to institution or country to country.

Working from the grades alone is often the simplest option, as an A+ always equates to 4.00 quality points, an A to 3.67 and an A- to 3.33. Each subsequent grade is worth 1/3 less than the previous grade. Although a C, D or E is typically a fail, the quality points are still valid for GPA/CGPA calculations.

There are various ways to convert grades to quality points but one of the simplest to implement is a lookup table where grades are mapped to values in the range 0.00 to 4.00.

Armed with this information it will be possible to write a C++ program to calculate GPA and/or CGPA, where the user simply selects the grade and credit hours for each unit in the academic term and/or terms.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you calculate cgpa using c plus plus program?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

C plus plus program using a stacks converting a postfix-infix?

Yes


Program to get a system time using c plus plus?

time in hours second minute


How do you calculate percentage of marks obtained in 1 subject in c plus plus?

You can't, you have to come up with variables to calculate grades


C plus plus program calculate the power value of input base and exponent numbers?

cn = c0 *( 1 + i ) pow n


How do you write a program in C plus plus plus plus How do you write a program in C to swap two variables without using the third oneo swap two variables without using the third one?

To swap two variables without using a third variable, use exclusive or manipulation... a ^= b; b ^= a; a ^= b;


Program to generate Fibonacci series using storage class in c plus plus?

i dn't know. haha


How do you write a C plus plus program that displays a pyramid of Xes on the screen using a for loop?

printf ("x")


Any program in c plus plus without using any header file?

For example: int main (void) { return 0; }


How do you display stars in c plus plus using the if else structure and a for loop and you use void main?

It depends on what program you design really


What is 56 plus 67?

The equation that is 56 plus 67 has an answer that is 123. You can solve simple equations like this one by using your calculator program on your computer.


What is the importance of functions in a c plus plus program?

Functions are very important in C++, as you can't write the simplest program to print hello without using a function. Overall you can say that function are building blocks of a C++ program. Functions can also be defined by the programmer to reduce program size.


What is the success rate of fourth graders using the Reading Plus program?

It is unfortunate the way American schools and their academic success is going these days. And, it is very sad to also say that among 4th grade pupils only 36 percent were successful using the Reading Plus program.