Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 2012/5.0 > C# 2012/5.0 General Discussion
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
C# 2012/5.0 General Discussion Discussions about the C# 2012 language and tool not related to any specific Wrox book
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2012/5.0 General Discussion section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old May 21st, 2017, 12:39 PM
Registered User
Points: 10, Level: 1
Points: 10, Level: 1 Points: 10, Level: 1 Points: 10, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2017
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default calculating gpa with only grades?

is there some sort of calculation for just GPA without knowing the credits? i wrote a program which shows the average 20students have each after taking 3 exams each. now i must print the GPA of each student, as well as which has the highest GPA. i looked up some formulas via google search and didn't find much because the way GPA is calculated involves the credits taken.
code:
#include<stdio.h>
int main()
{
float exam_a[20] = { 77, 65, 89, 79, 85, 90, 98, 45, 83, 75, 71, 85, 85, 80, 68, 72, 56, 82, 63, 80} ;
float exam_b[20] = { 87, 92, 84, 89, 75, 99, 92, 66, 80, 77, 56, 79, 76, 78, 88, 78, 66, 70, 69, 90} ;
float exam_c[20] = { 45, 77, 87, 77, 88, 83, 94, 71, 73, 83, 52, 80, 93, 88, 76, 64, 75, 80, 85, 52} ;
int k;
char letter;
float student[20];
float sum_a = 0, sum_b = 0, sum_c = 0, sum_d = 0, sum_f = 0;
int tot_a = 0, tot_b = 0, tot_c = 0, tot_d = 0, tot_f = 0;
for (k = 0; k < 20; ++k){
sum_a = sum_a + exam_a[k];
student[k] = exam_a[k] + exam_b[k] + exam_c[k];
student[k] = (student[k])/3;


if (student[k] >= 90){
letter = 'A';
++tot_a;
}
else if (student[k] >= 80){
letter = 'B';
++tot_b;
}
else if (student[k] >= 70) {
letter = 'C';
++tot_c;
}
else if (student[k] >= 60) {
letter = 'D';
++tot_d;
}

else {
letter = 'F';
++tot_f;
}
}
printf("(Based on Averages)Number of As = %i \number of Bs = %i \number of Cs = %i \number of Ds = %i \number of Fs = %i \n", tot_a, tot_b, tot_c, tot_d, tot_f);

}
is to show which students got what grades on the average of 3 exams. i was thinking of maybe just doing if 95 and over store 4.0 90 and over store 3.7 and so on.. unless theres a better way to calculate this.
Example: https://gpahub.net
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help with Sorting grades. Raunom123 Visual Basic 2010 General Discussion 0 June 15th, 2014 04:01 PM
Students,Courses, and Grades frdata BOOK: Beginning Database Design Solutions ISBN: 978-0-470-38549-4 11 May 11th, 2014 12:00 PM
GPA Calculator Final Method IsoftTech C# 2012/5.0 General Discussion 3 March 23rd, 2014 10:30 PM
GPA Calculator xenoalien C# 1 November 30th, 2007 03:25 AM
Calculating ashik112 ASP.NET 1.0 and 1.1 Basics 2 February 14th, 2007 12:49 PM



All times are GMT -4. The time now is 03:35 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.