Tuesday, December 1, 2020

BUBBLE SORT IN DECENDING ORDER

 I will show you how to write a program that will ask the user to give a series of numbers and then the program will sort the given number using a bubble sort algorithm in descending order in C++ programming language.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod City I also accepting computer repair, networking, and Arduino Project development at a very affordable price. My website is www.jakerpomperada.blogspot.com and www.jakerpomperada.com

If you like this video please click the LIKE button, SHARE, and SUBSCRIBE to my channel.

Your support on my channel is highly appreciated.

Thank you very much.



Program Listing

// bubble_sort.cpp

// Mr. Jake Rodriguez Pomperada,MAED-IT, MIT

// Dev C++

// www.jakerpomperada.com , www.jakerpomperada.blogspot.com

// jakerpomperada@gmail.com

// Bacolod City, Negros Occidental Philippines


#include <cstdlib>

#include <iostream>


using namespace std;


int compare(int, int);

void sort(int[], const int);

void swap(int *, int *);


int compare(int x, int y)

     return(x < y);

}


void swap(int *x, int *y)

{

     int temp;

     temp = *x;

     *x = *y;

     *y = temp;

}


void sort(int table[], const int n)

{

     for(int i = 0; i < n; i++)

     {

          for(int j = 0; j < n-1; j++)

          {

               if(compare(table[j], table[j+1]))

                    swap(&table[j], &table[j+1]);

          }

     }

}


int quantity;

int* tab;


int main(int argc, char *argv[])

{

    cout << "\n\n"; 

cout << "\t\t\tBUBBLE SORT IN DECENDING ORDER\n";

    cout << "\n\t\t Created By: Mr. Jake R. Pomperada, MAED-IT, MIT";

    cout << "\n\n";   

    cout << "\tHow Many Items :=> ";

cin >> quantity;

tab = new int [quantity];

cout << "\n\n";   

for (int i = 0; i < quantity; i++)

{

    int x = i;

    cout << "\tGive value in item no. " << ++x << ": ";

    cin >> tab[i];

}


cout << "\n\tBefore Sorting: ";

cout << "\n\n";

cout << "\t";

for (int i = 0; i < quantity; i++)

{

     cout << tab[i] << " ";

}


cout << "\n\n";

cout << "\tAfter Sorting: \n";

sort(tab, quantity);

cout << "\n\n";

cout <<"\t";

for(int i = 0; i < quantity; i++)

{

     cout << tab[i] << " ";

}

 cout << "\n\n";

    system("PAUSE");

    return EXIT_SUCCESS;

}


Employees Payroll System in C++

Employee's Payroll System in C++

 An Employee's Payroll System that I wrote using a C++ programming language to solve the salary of the employees in the company.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod City I also accepting computer repair, networking, and Arduino Project development at a very affordable price. My website is www.jakerpomperada.blogspot.com and www.jakerpomperada.com

If you like this video please click the LIKE button, SHARE, and SUBSCRIBE to my channel.

Your support on my channel is highly appreciated.

Thank you very much.




Program Listing

// payroll.cpp

// Mr. Jake Rodriguez Pomperada,MAED-IT, MIT

// Dev C++ 

// www.jakerpomperada.com , www.jakerpomperada.blogspot.com

// jakerpomperada@gmail.com

// Bacolod City, Negros Occidental Philippines

// December 1, 2020    Tuesday


#include <iostream>

#include <string>

#include <iomanip>


using namespace std;


struct employee {

    string name, department;

    int age;

    char gender;

    float days, rate;

};


main() {


    float solve=0.00;

    string sex;

    employee user;


     cout << "\t\tEmployee's Payroll System in C++";

     cout << "\n\n";

     cout << "\t Created By: Mr. Jake R. Pomperada,MAED-IT, MIT";

     cout << "\n\n";

     cout << "Enter the Name of the Employee    : ";

     getline(cin,user.name);

     cout << "Enter the Name of Department      : ";

     getline(cin,user.department);

     cout << "Enter the Gender of the Employee  : ";

     user.gender = getchar();

     cout << "Enter the Number of Days Worked   :  ";

     cin >> user.days;

     cout << "Enter the Daily Rate              :  ";

     cin >> user.rate;


     solve = (user.days * user.rate);

     if (user.gender == 'M' || user.gender == 'm')

        {

          sex = "Male";

        }

     else if (user.gender == 'F' || user.gender == 'f')

        {

          sex = "Female";

        }

    cout << fixed;

    cout << setprecision(2);

     cout << "\n\n";

     cout << "\t ===== GENERATED REPORT =====";

     cout << "\n\n";

     cout << "\nEmployee Name : " << user.name;

     cout << "\nDeparment     : " << user.department;

     cout << "\nGender        : " << sex;

     cout << "\nSalary        : $" << solve;

     cout << "\n\n";

     system("pause");

}

Monday, November 30, 2020

STUDENT GRADING AND INFORMATION SYSTEM IN C

 A database program that I called Student Grading and Information System in C which uses binay file to add, update, view, and delete the student records.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod City I also accepting computer repair, networking, and Arduino Project development at a very affordable price. My website is www.jakerpomperada.blogspot.com and www.jakerpomperada.com

If you like this video please click the LIKE button, SHARE, and SUBSCRIBE to my channel.

Your support on my channel is highly appreciated.

Thank you very much.



Program Listing

/* student_system.c 

   Mr. Jake Rodriguez Pomperada,MAED-IT, MIT

   Dev C++

   www.jakerpomperada.com , www.jakerpomperada.blogspot.com

   jakerpomperada@gmail.com

   Bacolod City, Negros Occidental Philippines.

 */

  

#include <stdio.h>

#include <stdlib.h>

#include <conio.h>

#include <ctype.h>

#include <string.h>


main( )

{

FILE  *fp, *ft ;

char  another, choice ;

struct student

{

char  stud_id[200];

char  name[200];

char  course[200];

char  sex;

int   age;

char  address[200];

char  email[200];

char  subject[200];

float prelim,midterm,endterm,final_grade;

} ;


struct student info ;

char student_id[200];

int flag=0;


long int  recsize ;


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


if ( fp == NULL )

{

fp = fopen ( "BIODATA.DAT", "wb+" ) ;


if ( fp == NULL )

{

puts ( "Cannot open file" ) ;

exit(0) ;

}

}


recsize = sizeof ( info ) ;


while (1)

{

        system("CLS");

        printf("\n");

    printf("\n==============================================");

        printf("\n");

        printf("\nSTUDENT GRADING AND INFORMATION SYSTEM IN C ");

        printf("\n");

        printf("\n===============================================");

  printf("\n\n");

printf ( "1. ADD STUDENT RECORDS") ;

printf("\n");

printf ( "2. DISPLAY STUDENT RECORDS" ) ;

printf("\n");

printf ( "3. UPDATE STUDENT RECORDS" ) ;

printf("\n");

printf ( "4. SEARCH STUDENT RECORDS" ) ;

printf("\n");

printf ( "5. DELETE STUDENT RECORDS" ) ;

printf("\n");

printf ( "6. QUIT PROGRAM" ) ;

printf("\n\n");

printf ("SELECT YOUR CHOICE : ") ;

fflush (stdin) ;

choice = getche() ;

switch (choice)

{

case '1' :

fseek (fp, 0 ,SEEK_END) ;

another = 'Y' ;


while ( another == 'Y' )

{

system("cls");

printf("\n\n");

                    printf("=== Add New Student Record in the Database ===");

                    printf("\n\n");

printf("Enter Student ID             : ");

scanf("%s",&info.stud_id);

printf("Enter Student Name           : ");

fflush(stdin);

gets(info.name);

printf("Enter Course                 : ");

fflush(stdin);

gets(info.course);

    printf("Enter Gender M/F             : ") ;

                    info.sex = toupper(getche());

                    printf("\n");

                    printf("Enter Age                    : ") ;

                    scanf("%d",&info.age);

                    printf("Enter Home Address           : ");

                    fflush(stdin);

gets(info.address);

printf("Enter Email Address          : ");

scanf("%s",&info.email);

printf("Enter Subject                  : ");

fflush(stdin);

gets(info.subject);

printf("Enter Prelim Grade           : ");

scanf("%f",&info.prelim);

printf("Enter Midtem Grade           : ");

scanf("%f",&info.midterm);

printf("Enter Endterm Grade           : ");

scanf("%f",&info.endterm);

info.final_grade = (info.prelim * 0.20) + (info.midterm * 0.30) + (info.endterm * 0.50);

printf("\n\n");

                    printf("\nFinal Grade         : %2.0f",info.final_grade);

fwrite ( &info, recsize, 1, fp ) ;

printf("\n\n");

printf ("\nAdd another Record (Y/N) : ") ;

fflush (stdin) ;

another = toupper(getche()) ;

}


break ;


case '2' :

    system("cls");

rewind (fp);

printf("\n\n");

                printf("=== View the Records in the Database ===");

                printf("\n\n");

while ( fread ( &info, recsize, 1, fp ) == 1 )

         {

    printf("\n");

            printf("\n Student ID          : %s",info.stud_id);

        printf("\n Name                : %s",info.name);

    printf("\n Course              : %s",info.course);

    printf("\n Gender              : %c",info.sex);

    printf("\n Age                 : %d",info.age);

    printf("\n Home Address        : %s",info.address);

    printf("\n Email Address       : %s",info.email);

    printf("\n Subject             : %s",info.subject);

    printf("\n Prelim Grade        : %2.0f",info.prelim);

    printf("\n Midterm Grade       : %2.0f",info.midterm);

    printf("\n Endterm Grade       : %2.0f",info.endterm);

    printf("\n");

    info.final_grade = (info.prelim * 0.20) + (info.midterm * 0.30) + (info.endterm * 0.50);

    printf("\n Final Grade         : %2.0f",info.final_grade);

printf("\n\n");

        }

            system("pause");

            break ;


case '3' :

               rewind (fp);


another = 'Y' ;

while (another == 'Y')

{

                    system("cls");

                    printf("=== Update Student Records in the Database ===");

                    printf("\n\n");

printf("\n");

                    printf("Enter Student ID Number      : ");

scanf("%s",&student_id);

rewind (fp) ;

while (fread( &info, recsize, 1, fp ) == 1 )

{

                    if ( strcmp ( info.stud_id, student_id ) == 0 )

                    {

                        printf("Enter Student ID       : ");

                        scanf("%s",info.stud_id);

                        printf("Enter Student Name     : ");

                        fflush(stdin);

                        gets(info.name);

                        printf("Enter Course           : ");

                        fflush(stdin);

                        gets(info.course);

                        printf("Enter Gender M/F       : ") ;

                        info.sex = toupper(getche());

                        printf("\n");

                        printf("Enter Age              : ") ;

                        scanf("%d",&info.age);

                        printf("Enter Home Address     : ");

                        fflush(stdin);

                        gets(info.address);

                        printf("Enter Email Address    : ");

                        scanf("%s",&info.email);

                        printf("Enter Subject          : ");

                        fflush(stdin);

                        gets(info.subject);

                        printf("Enter Prelim Grade     : ");

                        scanf("%f",&info.prelim);

                        printf("Enter Midtem Grade     : ");

                        scanf("%f",&info.midterm);

                        printf("Enter Endterm Grade    : ");

                        scanf("%f",&info.endterm);

                        printf("\n");

                        info.final_grade = (info.prelim * 0.20) + (info.midterm * 0.30) + (info.endterm * 0.50);

                        printf("\n Final Grade         : %2.0f",info.final_grade);

                        printf("\n\n");

                        printf("Records has been updated in the database.");

                        printf("\n\n");

                        system("pause");

fseek ( fp, - recsize, SEEK_CUR ) ;

fwrite ( &info, recsize, 1, fp ) ;

break ;

                    }

                }

             if (strcmp(info.stud_id,student_id) != 0 )

                    {

                        printf("\n\n");

                        printf("No Record in the Database.");

                        printf("\n");

                        system("pause");

                        break;

                    }

                    printf("\n\n");

printf ( "\nUpdate Another Record (Y/N) : " ) ;

fflush (stdin) ;

another = toupper(getche());

}


break ;


case '4' :

                rewind (fp);


another = 'Y' ;

while ( another == 'Y' )

{

                    system("cls");

                    printf("=== Search Student Records in the Database ===");

                    printf("\n\n");

    printf("Enter Student ID       : ");

scanf("%s",&student_id);

printf("\n");

rewind (fp) ;

while ( fread( &info, recsize, 1, fp ) == 1 )

{

if (strcmp(info.stud_id,student_id) == 0 )

{

                            printf("\n");

                            printf("\n ID Number           : %s",info.stud_id);

                            printf("\n Name                : %s",info.name);

                            printf("\n Course              : %s",info.course);

                            printf("\n Gender              : %c",info.sex);

                            printf("\n Age                 : %d",info.age);

                            printf("\n Home Address        : %s",info.address);

                            printf("\n Email Address       : %s",info.email);

                            printf("\n Subject             : %s",info.subject);

                            printf("\n Prelim Grade        : %2.0f",info.prelim);

                            printf("\n Midterm Grade       : %2.0f",info.midterm);

                            printf("\n Endterm Grade       : %2.0f",info.endterm);

                            printf("\n");

                            info.final_grade = (info.prelim * 0.20) + (info.midterm * 0.30) + (info.endterm * 0.50);

                            printf("\n Final Grade         : %2.0f",info.final_grade);

                            printf("\n\n");

                            system("pause");

                            break;

                }

}


            if (strcmp(info.stud_id,student_id) != 0 )

                    {

                        printf("\n\n");

                        printf("No Record in the Database.");

                        printf("\n\n");

                        system("pause");

                        break;

                    }

                    printf("\n\n");

printf ( "\n Search Another Student Record (Y/N) : " ) ;

fflush (stdin) ;

another = toupper(getche());

}

break ;


case '5' :

another = 'Y' ;

while ( another == 'Y' )

{

system("cls");

flag=0;

                    printf("=== Delete Student Records in the Database ===");

                    printf("\n\n");

printf("Enter Student ID       : ");

scanf("%s",&student_id);

printf("\n");


    ft = fopen ("TEMP.DAT", "wb") ;

rewind (fp) ;

while (fread (&info, recsize, 1, fp) == 1 )

{

if (strcmp(info.stud_id, student_id) != 0 )

fwrite(&info, recsize, 1, ft ) ;

else

                            flag=1;

}


fclose (fp) ;

fclose (ft) ;

remove ("BIODATA.DAT") ;

rename ("TEMP.DAT", "BIODATA.DAT") ;

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


                  if(flag==1) {

                        printf("\n\n");

                        printf("Record Successfully Deleted From the Database.");

                        printf("\n\n");

                        system("pause");

                    }


else if (flag!=1) {

                        printf("\n\n");

                        printf("Sorry Record Not Found in the Database.");

                        printf("\n\n");

                        system("pause");


                    }


                        printf("\n\n");

                        printf( "Delete Another Record (Y/N) " ) ;

                        fflush ( stdin ) ;

                        another = toupper(getche());

}

break ;


case '6' :

fclose (fp) ;

printf("\n\n");

/* textcolor(YELLOW+BLINK); */

printf("             Thank You For Using This Program !!!   ");

printf("\n\n");

system("PAUSE");

exit(0);

}

}

} /* End of Code */