assessment program

hello guys
i made this code for the universty assignment i get 1.2 total gpa but when i did on hard copy i get 1.4 why values are
20,40,50,
code
#include<stdlib.h>
#include<iostream>
using namespace std;

int main()
{
// varibales Declaration!
int English_subject, Computer_subject, Calculas_subject;
float english_GPA, computer_GPA, calculas_GPA, total_CGPA;
char grades,Function_return_to_start;
do {

//This command is used for Clear Screen
system("cls");

cout<<"******************************Assesment system*********************************\n\n";
// Marks of English which we enter when program is Run!

cout<<"\t\t###***** Welcome To BSCS 2nd Semester Group *****###! \n\n\t\t\tCS201 Fist Assignment compelete Solution\n";


cout << "\n\nPlease Enter Marks of Englsih:\t";
cin >> English_subject;

if (English_subject < 40)
{
english_GPA = 0.00;
}
else
{
english_GPA = ((float)English_subject/100)*4;
}

// using to print the marks of computer.
cout << "\nPlease Enter Marks of Computer:\t";
cin >> Computer_subject;

if (Computer_subject <40)
{
computer_GPA = 0.00;
}
else
{

computer_GPA = ((float)Computer_subject/100)*4;
}

// using to print the marks of calculas.
cout << "\nPlease Enter Marks of Calculus:\t";
cin >> Calculas_subject;

if (Calculas_subject <40)
{
calculas_GPA = 0.00;
}
else
{
calculas_GPA = ((float)Calculas_subject/100)*4;
}

// Calculate Total CGPA
total_CGPA = 3 * ( english_GPA + computer_GPA + calculas_GPA ) / 9 ;


// Grades Calculation

if (total_CGPA == 4)
{
grades = 'A';
}
else if (total_CGPA >= 3.00 and total_CGPA <= 3.99)
{
grades = 'B';
}
else if (total_CGPA >= 2.00 and total_CGPA <= 2.99)
{
grades = 'C';
}
else if (total_CGPA >= 1.00 and total_CGPA <= 1.99)
{
grades = 'D';
}
else
{
grades = 'F';
}

cout << "\n\nCGPA \t\tGrade \t\tRemarks\n";
cout << total_CGPA << "\t\t" << grades ;
if (grades == 'A')
{
cout << "\t\tExcellent";
}else if (grades == 'B')
{
cout << "\t\tSatisfactory";
}else if (grades == 'C')
{
cout << "\t\tGood";
}else if (grades == 'D')
{
cout << "\t\tPass";
}else if (grades == 'F')
{
cout << "\t\t Fail";
}


// Warning messages for Zero CGP.
if (english_GPA == 0.00)

{
cout << "\n\n!You have to repeat English subject";
}
if (computer_GPA == 0.00)
{
cout << "\n\n!You have to repeat Computer subject";
}
if (calculas_GPA == 0.00)
{
cout << "\n\n!You have to repeat Calculus subject";
}
cout << "\n\n Do you want to repeat (Y/N)? \t";
cin >> Function_return_to_start;
}
while (Function_return_to_start== 'Y' or Function_return_to_start== 'y');

}
Can you show your hard copy with code tags...<>

I've done it with normal calculator and it shows 1.2 too...
GPA = 20/100*4 = 0.8
GPA = 50/100*4= 2
GPA = 40/100*4=1.6
Total gpa = 3 * 0.8+ 2+ 1. 6 / 9=1.46
Your code says that any grade lower than 40 is automatically assigned a GPA of 0.0...

English = 20 -> 0.0 GPA
Computer = 40 -> 40 / 100 * 4 = 1.6 GPA
Calculus = 50 -> 50 / 100 * 4 = 2.0 GPA

Total GPA = (0.0 + 1.6 + 2.0) / 3 = 3.6 / 3 = 1.2 GPA
+1 to fg109.

when I calculated it manually, I was also assigning 0 to English...
thankx my mistake marks < 40 should be o thankx
can some one tell me why to use
#include<stdlib.h>
i am confused why
please some one explain
Topic archived. No new replies allowed.