Source Code for QB Rater

Source Code for QB Rater I made in my spare time if your interested.
It's in C but will compile on C++ compilers.

//Peter Wagner


#include <stdio.h>

int main()
{
printf("Welcome to the QB Rater Program\nEnter the QB's Stat's to calculate rating\n");

float passAttempt, passComplete, yardsGain, touchdown, interception;

printf("\nPasses attempted: ");
scanf("%d", &passAttempt);

printf("\nPasses completed: ");
scanf("%d", &passComplete);

printf("\nYards gained: ");
scanf("%d", &yardsGain);

printf("\nTouchdowns: ");
scanf("%d", &touchdown);

printf("\nInterceptions: ");
scanf("%d", &interception);

float completionRating = ((passComplete / passAttempt * 100) - 30)* .05 ;
if (completionRating > 2.375)
completionRating = 2.375;
if (completionRating < 0)
completionRating = 0;
printf("\nThe completion rating is %1.3f", completionRating);

float yardsRating = ((yardsGain / passAttempt) - 3) * .25;
if (yardsRating > 2.375)
yardsRating = 2.375;
if (yardsRating < 0)
yardsRating = 0;
printf("\nThe yards rating is %1.3f", yardsRating);

float touchdownRating = (touchdown / passAttempt * 100) * .2;
if (touchdownRating > 2.375)
touchdownRating = 2.375;
printf("\nThe touchdown rating is %1.3f", touchdownRating);


float interceptionRating= 2.375 - ((interception / passAttempt * 100) * .25);
if (interceptionRating < 0)
interceptionRating = 0;
printf("\nThe interception rating is %1.3f", interceptionRating);

float qb_rating = ((completionRating + yardsRating + touchdownRating + interceptionRating)/6) * 100;
printf("\n\nThe QB Rating is %3.1f", qb_rating);

}
Topic archived. No new replies allowed.