Saturday, October 15, 2016

Student Grading Database System in C

A simple program that I wrote to show database development using Binary File in C programming language. I called this application Student Grading Database System in C which enables the user to add, edit, delete, view and quit student grade records it stores the record of the student in the binary file. I am using Dev C++ as my C compiler but the I code can also run in a typical Borland Turbo C or Turbo C++ compiler in DOS. I hope you will find my work useful. Thanks a lot.

Add me at Facebook my addressis jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My mobile number here in the Philippines is 09173084360.











Sample Program Output


Program Listing

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
#include <ctype.h>

main( )
{
FILE  *fp, *ft ;
char  another, choice ;
struct student
{
char  stud_id_no[300];
char  name[300];
char  course[300];
char  subject[300];
float prelim,midterm,endterm,final_grade;
} ;
struct student grade;
char student_id[300];
long int  recsize;
    int flag=0;

fp = fopen ("GRADE_DB.DAT", "rb+" ) ;

if ( fp == NULL )
{
fp = fopen ( "GRADE_DB.DAT", "wb+" ) ;

if ( fp == NULL )
{
puts ( "Cannot open file" ) ;
exit(0) ;
}
}

recsize = sizeof ( grade ) ;

while ( 1 )
{
        system("CLS");
        printf("\n");
printf("\n======================================");
printf("\n");
printf("\nSTUDENT GRADING DATABASE SYSTEM ");
printf("\n");
printf("\n======================================");
printf("\n\n");
printf ( "1. INSERT STUDENT RECORD" ) ;
printf("\n");
printf ( "2. BROWSE STUDENT RECORD" ) ;
printf("\n");
printf ( "3. EDIT STUDENT RECORDS" ) ;
printf("\n");
printf ( "4. FIND STUDENT RECORDS" ) ;
printf("\n");
printf ( "5. REMOVE STUDENT RECORDS" ) ;
printf("\n");
printf ( "6. QUIT PROGRAM" ) ;
printf("\n\n");
printf ("SELECT YOUR OPTION :=> " ) ;
fflush (stdin) ;
choice = getche() ;
switch ( choice )
{
case '1' :

fseek ( fp, 0 , SEEK_END ) ;
another = 'Y' ;

while ( another == 'Y' )
{
system("cls");
printf("\n\n");
printf("=== INSERT NEW STUDENT GRADE RECORD ===");
printf("\n\n");
printf("Enter Student ID Number      : ");
                    scanf("%s",&grade.stud_id_no);
printf("Enter Student Name           : ");
fflush (stdin) ;
gets(grade.name);
printf("Enter Course                 : ");
fflush (stdin) ;
gets(grade.course);
                    printf("Enter Subject                  : ");
fflush (stdin) ;
gets(grade.subject);
printf("Enter Prelim Grade           : ");
scanf("%f",&grade.prelim);
printf("Enter Midtem Grade           : ");
scanf("%f",&grade.midterm);
printf("Enter Endterm Grade           : ");
scanf("%f",&grade.endterm);
grade.final_grade = (grade.prelim * 0.30) + (grade.midterm * 0.30) + (grade.endterm * 0.40);
printf("\n");
                    printf("\n Student Final Grade         : %2.0f",grade.final_grade);
fwrite (&grade, recsize, 1, fp ) ;
printf("\n\n");
printf ( "\nAdd New Student Record (Y/N)  : " ) ;
fflush (stdin) ;
another = toupper(getche()) ;
}

break ;

case '2' :
           system("cls");
rewind ( fp );
printf("\n\n");
                printf("=== VIEW STUDENT GRADE RECORD ===");
                printf("\n\n");
while ( fread ( &grade, recsize, 1, fp ) == 1 )
            {
                printf("\n");
                printf("\n ID  Number          : %s",grade.stud_id_no);
                printf("\n Name                : %s",grade.name);
                printf("\n Course              : %s",grade.course);
                printf("\n Subject             : %s",grade.subject);
                printf("\n Prelim Grade        : %2.0f",grade.prelim);
                printf("\n Midterm Grade       : %2.0f",grade.midterm);
                printf("\n Endterm Grade       : %2.0f",grade.endterm);
                printf("\n");
                grade.final_grade = (grade.prelim * 0.30) + (grade.midterm * 0.30) + (grade.endterm * 0.40);
                printf("\n Student Final Grade         : %2.0f",grade.final_grade);
     }
                printf("\n\n");
                system("pause");
break ;

case '3' :
   another = 'Y' ;
while ( another == 'Y' )
{
   system("cls");
           printf("=== EDIT STUDENT GRADE RECORD ===");
           printf("\n\n");
printf("Enter Student ID Number      : ");
                    scanf("%s",&student_id);
rewind ( fp ) ;
printf("\n");

while ( fread ( &grade, recsize, 1, fp ) == 1 )
{
if ( strcmp ( grade.stud_id_no, student_id) == 0 )
{
printf("Enter Student ID Number      : ");
                            fflush (stdin) ;
                            gets(grade.stud_id_no);
printf("Enter Student Name     : ");
fflush ( stdin ) ;
gets(grade.name);
       printf("Enter Course           : ");
fflush ( stdin ) ;
gets(grade.course);
printf("Enter Subject          : ");
fflush ( stdin ) ;
gets(grade.subject);
printf("Enter Prelim Grade     : ");
scanf("%f",&grade.prelim);
printf("Enter Midtem Grade     : ");
scanf("%f",&grade.midterm);
printf("Enter Endterm Grade    : ");
scanf("%f",&grade.endterm);
printf("\n");
grade.final_grade = (grade.prelim * 0.20) + (grade.midterm * 0.30) + (grade.endterm * 0.50);
printf("\n Student Final Grade         : %2.0f",grade.final_grade);
fseek ( fp, - recsize, SEEK_CUR ) ;
fwrite ( &grade, recsize, 1, fp ) ;
break ;
}

}
if (strcmp(grade.stud_id_no,student_id) != 0 )
                    {
                        printf("\n\n");
                        printf("No Student Record in the Database.");
                        printf("\n");
                        system("pause");
                        break;
                    }
                    printf("\n\n");
printf ( "\nEdit Another Student Record (Y/N) : " ) ;
fflush ( stdin ) ;
another = toupper(getche());
}

break ;

case '4' :
          rewind ( fp ) ;
          another = 'Y' ;
while ( another == 'Y' )
{
   system("cls");
   printf("=== Find Student Records ===");
   printf("\n\n");
printf("Enter Student ID Number      : ");
                    scanf("%s",&student_id);
printf("\n");
rewind ( fp ) ;
while ( fread ( &grade, recsize, 1, fp ) == 1 )
{
if ( strcmp (grade.stud_id_no,student_id) == 0 )
{
                    printf("\n");
printf("\n ID Number           : %s",grade.stud_id_no);
printf("\n Name                : %s",grade.name);
printf("\n Course              : %s",grade.course);
           printf("\n Subject             : %s",grade.subject);
                    printf("\n Prelim Grade        : %2.0f",grade.prelim);
                    printf("\n Midterm Grade       : %2.0f",grade.midterm);
                    printf("\n Endterm Grade       : %2.0f",grade.endterm);
                    printf("\n");
                    grade.final_grade = (grade.prelim * 0.30) + (grade.midterm * 0.30) + (grade.endterm * 0.40);
                    printf("\n Student Final Grade         : %2.0f",grade.final_grade);
                    printf("\n\n");
                    system("pause");
                     break;
}
                    }

                    if (strcmp(grade.stud_id_no,student_id) != 0 )
                    {
                        printf("\n\n");
                        printf("No Student Record found in the Database.");
                        printf("\n");
                        system("pause");
                        break;
                    }
                    printf("\n\n");
printf ( "\n Find Another Student Record (Y/N) : " ) ;
fflush ( stdin ) ;
another = toupper(getche());
}

break ;

case '5' :
another = 'Y' ;
while ( another == 'Y' )
{
system("cls");
                    printf("=== REMOVE STUDENT GRADE RECORD ===");
                    printf("\n\n");
printf("Enter Student ID Number      : ");
                    scanf("%s",&student_id);
printf("\n");
ft = fopen ( "TEMP.DAT", "wb" ) ;
rewind ( fp ) ;
while ( fread ( &grade, recsize, 1, fp ) == 1 )
{
if ( strcmp (grade.stud_id_no, student_id) != 0 )
fwrite ( &grade, recsize, 1, ft ) ;
                        else
                            flag=1;
                    }
fclose ( fp ) ;
fclose ( ft ) ;
remove ( "GRADE_DB.DAT" ) ;
rename ( "TEMP.DAT", "GRADE_DB.DAT" ) ;
   fp = fopen ( "GRADE_DB.DAT", "rb+" ) ;

                  if(flag==1) {
                        printf("\n\n");
                        printf("Record Successfully Deleted From the Database.");
                         printf("\n");
                       system("pause");
                    }
else if (flag!=1) {
                        printf("\n\n");
                        printf("Record Not Found in the Database.");
                        printf("\n");
                        system("pause");

                    }
                    printf("\n\n");
printf( "Remove Another Student Record (Y/N) : " ) ;
fflush (stdin) ;
another = toupper(getche());
}
break ;

case '6' :
fclose ( fp ) ;
printf("\n\n");
printf("   END OF PROGRAM    ");
printf("\n\n");
system("PAUSE");
exit(0);

}
}
}




Meeting With the Father of PHP Programming Language

Last October 14, 2016 my cousin invited me for a dinner in one of the restaurant in Greenbelt 3 Makati City, Philippines while we are having our dinner I saw Rasmus Lerdorf the creator and father of PHP programming language eating also in the same restaurant.

I approach him and introduce myself I told him I am thankful because of your creator I have a job and I was able to support my family. He is smiling and happy to know that his work able to help our people not only in their work but also their lives as well. He is very kind and approachable people and the best part he is very humble too. 

For me PHP programming language is one of the best programming language in the world in terms in creating web applications their are some flaws on PHP but it can be improve.  Here is some of our pictures below.




With Rasmus Lerdorf Father of PHP Programming Language


Together With My Cousin Ken



Selfie Moment


Student Grade Viewer System in PHP and MySQL

In this article I would like to share with you a program that I and my friend and fellow software engineer Mr. Dave Marcellana develop we can't this application Student Grade Viewer System in PHP and MySQL. This application enables teachers act as administrator to upload the grades of their perspective students in their subject and then the students can view their grades online using this application. We are using twitter bootstrap for the design and layout of our web forms. I hope you will find our work useful. Thank you.

Add me at Facebook my addressis jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My mobile number here in the Philippines is 09173084360.






Sample Program Output








Saturday, October 8, 2016

Foot To Inch Solver in Delphi

A very simple program that I wrote in Borland International Delphi programming language that will ask the user to give a value in foot and then it will convert the given value into inch equivalent.

Add me at Facebook my addressis jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My mobile number here in the Philippines is 09173084360.





Sample Program Output


Program Listing

unit foot_to_inch;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Edit1: TEdit;
    Label5: TLabel;
    Button1: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}


Var inch : real;


procedure TForm1.Button1Click(Sender: TObject);
begin
 inch:=strtoint(Edit1.text) * 12;
 label5.caption := Edit1.text + ' Foot is equivalent to '
                   +  FloatToStr(inch) + ' Inche(s).';
                   

end;

procedure TForm1.Button2Click(Sender: TObject);
begin
edit1.text     :='';
label5.caption := '';
edit1.setfocus;
end;

end.


Square Root Solver in Delphi

Here is a simple program that I wrote in Delphi that will ask the user to give a number and then our program will convert the given number by the user into its square root equivalent.

Add me at Facebook my addressis jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My mobile number here in the Philippines is 09173084360.





Sample Program Output


Program Listing

unit squareroot;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Edit1: TEdit;
    Label5: TLabel;
    Button1: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}


Var value : real;


procedure TForm1.Button1Click(Sender: TObject);
begin
 value:=sqrt(strtoint(Edit1.text));
 label5.caption := 'The Square Root Equivalent of '
           + Edit1.text +  ' is ' +  FloatToStr(value) + '.';
                   

end;

procedure TForm1.Button2Click(Sender: TObject);
begin
edit1.text     :='';
label5.caption := '';
edit1.setfocus;
end;

end.

Reverse a Number in Delphi

I wrote a simple program in Delphi that will ask the user to give a series of number and then our program will reverse the arrangement of the given number by the user.

Add me at Facebook my addressis jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My mobile number here in the Philippines is 09173084360.





Sample Program Output


Program Listing

unit reverse;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Edit1: TEdit;
    Label5: TLabel;
    Button1: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}


Var value : String;


function ReverseString(const s: string): string; 
var 
  i, len: Integer; 
begin
  len := Length(s);
  SetLength(Result, len); 
  for i := len downto 1 do 
  begin 
    Result[len - i + 1] := s[i]; 
  end; 
end;


procedure TForm1.Button1Click(Sender: TObject);
begin
 value:=Edit1.text;
 label5.caption := 'The reversed equivalent is '
                   + ReverseString(value) + '.';

end;

procedure TForm1.Button2Click(Sender: TObject);
begin
edit1.text     :='';
label5.caption := '';
edit1.setfocus;
end;

end.




Reverse a Number Using While Loop Using Turbo Pascal

A simple program that wrote using Turbo Pascal For Windows to accept a series of numbers and then our program will reverse the arrangement of the number being provided by the user.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My mobile number here in the Philippines is 09173084360.




Sample Program Output


Program Listing

Program Revese_Num_Using_while_loop;
Uses WinCrt;

Var
  N,R : Longint;
  
Begin
 Clrscr;
 Write('Reverse a Number Using While Loop Using Turbo Pascal');
 Writeln;
 Writeln;
 Writeln;
 Write('Give a Number : ');
 Readln(N);
 Writeln; Writeln;
 Write('The Reversed Number :==> ');

  While (N<>0) Do
     Begin
  R := N mod 10;
  Write(R);
  N := N Div 10;
End;
Writeln;
Writeln;
Write('End of Program');
Readln;
End.