//How to calculate our program
#include<stdio.h>
#include<string.h>
#include<conio.h>
#include<windows.h>
double marksToGradePoint(float marks);
char *marksToGrade(float marks);
void myExit(void);
void menu(void);
void smallMenu(void);
void line(void);
void intro(void);
void time (void);
char DisplayName(void);
int password(void);
int DisplayStudentID(void);
void header (void);
void GPA(void);
float getMarks(void);
void main()
{
intro();
time();
}
double marksToGradePoint(float marks)
{
if(marks>=80 && marks<=100)
{
return 4.00;
}
else if(marks>=75 && marks<=79)
{
return 3.67;
}
else if(marks>=70 && marks<=74)
{
return 3.33;
}
else if(marks>=65 && marks<=69)
{
return 3.00;
}
else if(marks>=60 && marks<=64)
{
return 2.67;
}
else if(marks>=55 && marks<=59)
{
return 2.33;
}
else if(marks>=50 && marks<=54)
{
return 2.00;
}
else if(marks>=45 && marks<=49)
{
return 1.67;
}
else if(marks>=40 && marks<=44)
{
return 1.00;
}
else if(marks>=0 && marks<=39)
{
return 0.00;
}
else
{
printf("Wrong Marks please put the correct one!\n");
getch();
smallMenu();
}
}
char *marksToGrade(float marks)
{
if(marks>=80 && marks<=100)
{
return "A";
}
else if(marks>=75 && marks<=79)
{
return "A-";
}
else if(marks>=70 && marks<=74)
{
return "B+";
}
else if(marks>=65 && marks<=69)
{
return "B";
}
else if(marks>=60 && marks<=64)
{
return "B-";
}
else if(marks>=55 && marks<=59)
{
return "C+";
}
else if(marks>=50 && marks<=54)
{
return "C";
}
else if(marks>=45 && marks<=49)
{
return "C-";
}
else if(marks>=40 && marks<=44)
{
return "D";
}
else if(marks>=0 && marks<=39)
{
return "F";
}
else
{
printf("Wrong Marks please put the correct one!\n");
getch();
smallMenu();
}
}
float getMarks(void)
{
float marks;
printf("Enter marks:");
scanf("%f", &marks);
return marks;
}
void myExit(void)
{
system("cls");
printf("Thanks for using this program ^_^6 \n");
getchar();
}
void smallMenu(void)
{
int choice;
line();
printf("1. Back to main menu\n");
printf("0. Exit\n");
line();
printf("Please enter your choice:");
scanf("%d",&choice);
if(choice==1)
{
menu();
}
else if(choice==0)
{
myExit();
}
else
{
printf("Sorry wrong input..Press any key to continue");
getch();
menu();
}
}
void line(void)
{
printf("-----------------------------------------------------------------\n");
}
void intro(void)
{
printf("\n\n\n\n\n\n\t\tProgram Mark Conversion System\n");
printf("\n\t\t\t Credit to ...\n");
getch();
printf("\n\t\t\t\t Fathi Yaqan ^_^ \n");
printf("\n\t\t\t\t\t AND \n");
getch();
printf("\n\t\t\t\t\tWan Nursyahirah ~ \3 \n");
getch();
}
void header (void)
{
printf("Program Mark Conversion System \n");
line();
}
void time (void)
{
int hour,minute,second,c;
hour=minute=second=0;
for(c=0; c<=101 ; c++)
{
system("cls");
printf("\n\n\n\n\t\t\t Loading... %d%% \n\n\n\n",second);
Sleep(5);
second++;
if(second==101)
{
printf("\tProgram have been ready! Please prees ENTER to Continue ...\n");
getchar();
system("cls");
menu();
}
}
}
void GPA(void)
{
float marks[100];
double gp[100];
double sum_gpXch=0;
int sumCH=0;
int ch[100];
int c;
int noOfSubject;
system("cls");
header();
printf("Calculate gpa\n");
line();
printf("Enter no of subject:");
scanf("%d", &noOfSubject);
for(c=0;c<=noOfSubject-1;c++)
{
printf("Enter marks and credit hour for subject no %d\n",c+1);
marks[c]=getMarks();
printf("Enter Credit Hours:");
scanf("%d", &ch[c]);
gp[c]=marksToGradePoint(marks[c]);
sum_gpXch=+gp[c]*ch[c];
sumCH=+ch[c];
}
printf("The Grade Point Average is %.2f\n",sum_gpXch/sumCH);
}
void menu(void)
{
int second;
int choice,Student,c;
float marks[99];
double gp;
char grade[5];
char Nsubject[15][99];
float markah;
Student=0;
system("cls");
header();
choice=second=0;
printf("1. Mark to Grade Point (GP) Conversion\n");
printf("2. Mark to Grade Conversion\n");
printf("3. Mark to Grade Point and Grade\n");
printf("4. Calculate Gpa\n");
printf("0. Exit\n");
line();
printf("Please enter your choice:");
scanf("%d",&choice);
if(choice==1)
{
char nama[15][100];
int c;
double grp[99];
Student=0;
system("cls");
header();
printf("How many Student : ");
scanf("%d",&Student);
for(c=1 ; c<=Student ; c++ )
{
printf("Enter Student %d name :",c);
scanf("%s",&nama[c]);
}
printf("Subject number : ");
scanf("%d",&Student);
for(c=1 ; c<=Student ;c++ )
{
printf("Assalamualaikum Encik/Puan %s \n ",nama[c]);
printf("Please name that subject :");
scanf("%s",&Nsubject[c]);
}
for(c=1 ; c<=Student;c++ )
{
printf(" %s please insert marks for subject %s : ",nama[c],Nsubject[c]);
scanf("%f",&marks[c]);
}
for(c=1 ; c<=Student;c++ )
{
grp[c]=marksToGradePoint(marks[c]);
}
while(second<=3)
{ Sleep(1000);
second++;
printf("\n\n\n\n\t\t\t Please wait for %d second \n\n\n\n",second);
}
{
system("cls");
line();
printf("Nama\t\tSubject\t\tMarkah\t\tGrade\t\t \n");
line();
for(c=1 ; c<=Student;c++ )
{
printf("%s\t\t %s \t\t %.2f\t\t %.2f \n",nama[c],Nsubject[c],marks[c],grp[c]);
line();
getchar();
}
}smallMenu();
}
else if(choice==2)
{
header();
printf("How many Subject");
scanf("%d",&Student);
for(c=1 ;c<=Student ; c++)
{
markah=getMarks();
strcpy(grade,marksToGrade(markah));
printf("For marks=%.2f, the grade is %s \n",markah,grade);
}
smallMenu();
}
else if(choice==3)
{
header();
printf("How many Subject");
scanf("%d",&Student);
for(c=1 ; c<=Student;c++ )
{
markah=getMarks();
gp=marksToGradePoint(markah);
strcpy(grade,marksToGrade(markah));
printf("For marks=%.2f, the grade point =%.2f and the grade is %s\n",markah,gp,grade);
}smallMenu();
}
else if(choice==4)
{
GPA();
smallMenu();
}
else if(choice==5)
{
myExit();
}
else
{
printf("Sorry wrong input.Press any key to continue");
getch();
smallMenu();
}
}
In The Name Of Allah
Tuesday 9 April 2013
Monday 8 April 2013
STEPS IN PRODUCING THIS GPA & CGPA CALCULATOR…..
STEPS IN PRODUCING THIS
GPA & CGPA CALCULATOR…..
Firstly,
declare all the variables that are needed in making on the mini project.
After that, we using
function and in the function we use looping (for) and “if “. For the number of
a timer, uses “if”.
For
the marks, grade points and grades, put the switch (if, else if and else). For example, if we enter marks 80, this
software will automatically choose the grades that is between >=70
&&<=74. Then have set each mark has its own grade point and
grade such as:
Return is referring to chapter function to
return the value we call.
Next step, use “system
("cls")” as the command of
“conio”and “windows” to close the tab and open a new tab
and to stop for a few to next program. For the example is:
For
the second last, inserted the given formula on how too much user can put the
bill of students. Then, put the formula at the end of the switch and use for.
The example is shown below:
For the last, inserted the given formula on how to calculate the GPA. Then, put the formula at the end of the switch and use for & while. The example is shown below:
Subscribe to:
Posts (Atom)