Hey everyone, I am a true beginner programmer, in the crunch of finals week. I need to create a GPA calculator and I am having some difficulties. Anyone who can should help me!!!

Recommended Answers

All 6 Replies

Since you read the Announcement, what code are you having trouble with?

Since you read the Announcement, what code are you having trouble with?

I have a rough (very) verison of a GPA showing thing. (i'll post it so you can take a look. I am trying to figure out where to modify it so that it can ask the user what their grades were, and then give them their GPA.

VERY ROUGH sorry

#include <stdio.h>

display_matrix (matrix)
	int matrix [4] [6];
{
	int row, column;
	int x = 1;
	for (row=0; row<4; ++row)
	{
		printf(“Semester %d, x);
		for (col=0; col<6; ++col)
		{
			printf(“%6d	, matrix[row][col]);

		}
		printf(“\n);
		++x;
	}
}
/*print_matrix(m)
	static char m[];
{
	int x =0;
	do{
	printf(“m[x]\n);
	++x;
	}while(x<13);
}
*/

void main()
{
	float a=0,b=0,c=0,d=0;
	int e=0, f=0, g=0, h=0;
	int flag;
	char me [50]={“G,r,e,g, ,B,l,a,s,c,o,v,i,c,h}’;
	static int matrix [4] [6]=
	{
		{1,1,1,1,1,1},
		{2,4,4,4,3,3},
		{3,3,3,4,3,4},
		{4,3,3,4,4,4}
	};
	printf(“Do you want to:\n’0’ view all grades semesters 1-4 and current GPA?\n-or-\n’1’ view most current semester 4) and GPA\n);
	scanf(“%d, &flag);
	printf(“			english		science		math		history	academic elective	athletic elective\n);
	display_matrix (matrix);
	do{
		a=a+matrix[0][e];
		e++;
	}while(e<6);

	do{
		b=b+matrix[1][f];
		f++;
	}while(f<6);

	do{
		c=c+matrix[2][g];
		g++;
	}while(g<6);

	do{
		d=d+matrix[3][h];
		h++;
	}while(h<6);

	a=a/6;
	b=b/6;
	c=c/6;
	d=d/6;
	printf(“ semester1 GPA: %f\n semester2 GPA:%f\n semester3 GPA: %f\n semester4 GPA: %f\n,a,b,c,d);
	printf(“%c,me[50]);
}

<< moderator edit: added [code][/code] tags >>

please disregard the name, dont post it all over the place please

Lemme guess, can't use structures? Do you know how to take string input?

No, but I am willing to learn

No, but I am willing to learn

Structs or string input? I just posted this, so I'll hope you meant strings.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.