Tuesday, July 12, 2022

Delete The Vowels in a String in C++

 A program that I wrote in C++ that will ask the user to give a string and then the program will delete the vowels in the given string by the user.

 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.

Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg

=================================================


Want to support my channel?

GCash Account

Jake Pomperada


09173084360


Paypal

https://paypal.me/jakerpomperada


Patreon

https://www.patreon.com/jakerpomperada


Thank you very much for your support.





Program Listing

#include <iostream>
#include <conio.h>
#include <string.h>


using namespace std;

int main()
{

char str[100];
int chk=0, i=0, j=0;
cout <<"\n\n";
cout <<"\tDelete The Vowels in a String in C++\n\n";
cout<<"\tGive a string : ";
gets(str);
while(str[i]!='\0')
    {
        chk=0;
        if(str[i]=='a'||str[i]=='e'||str[i]=='i'||str[i]=='o'||str[i]=='u'||
           str[i]=='A'||str[i]=='E'||str[i]=='I'||str[i]=='O'||str[i]=='U')
        {
            j=i;
            while(str[j-1]!='\0')
            {
                str[j] = str[j+1];
                j++;
            }
            chk = 1;
        }
        if(chk==0)
            i++;
    }
cout <<"\n\n";
cout<<"\tAfter removing the vowels : \n\n";
cout <<"\t"<<str;
cout <<"\n\n";
cout <<"\tEnd of Program";
cout <<"\n";
getch();
}

Sunday, July 10, 2022

Square Pattern in C++

A simple program to demonstrate how to use nested for loop statement to generate square pattern using 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.

Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg

=================================================


Want to support my channel?

GCash Account

Jake Pomperada


09173084360


Paypal

https://paypal.me/jakerpomperada


Patreon

https://www.patreon.com/jakerpomperada


Thank you very much for your support.





Program Listing


square.cpp


#include <iostream>

using namespace std;


int main()

{

    int i,j,size=8;


   cout <<"\n\n";

  cout <<"\tSquare Pattern in C++";

   cout <<"\n\n";

    for(i=1; i<=size; i++){

       cout <<"\t";

        for(j=1; j<=size; j++){

        cout<<"*";

    }

   cout<<"\n";

    }

   return 0;

}


Saturday, July 9, 2022

Lydia's Store Payroll System in C

LYDIA'S STORE PAYROLL SYSTEM IN C

 A payroll program that I wrote a long time ago using C programming language and Dev C++.

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.

Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg

=================================================


Want to support my channel?

GCash Account

Jake Pomperada



09173084360


Paypal

https://paypal.me/jakerpomperada


Patreon

https://www.patreon.com/jakerpomperada


Thank you very much for your support.






Program Listing


/* Lydia's Store Payroll System in C 
   Programmer : Jake Rodriguez Pomperada, MAED-IT, MIT
   Date       : July 9, 2022
   wwww.jakerpomperada.com and 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>


struct employee
{
char  emp_id[100];
char  emp_name[100];
char  position[100];
char  department[100];
float basic_pay,allowance;
float philhealth,sss_gsis,withholding_tax;
float pag_ibig,total_deductions;
float gross_pay,net_pay;
};

/* creating an object info of the structure in C */

struct employee info ;

main()
{
/* File Handling routine here */
FILE  *fp, *ft ;
char  another, choice ;
char emp_id[100];
int flag=0;

long int  recsize ;
    /* Creating and opening  payroll.dat */
fp = fopen ( "PAYROLL.DAT", "rb+" ) ;

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

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

recsize = sizeof ( info ) ;


   /* declarion of menu of the employees payroll system in C here */
while (1)
{

        system("CLS"); 
        printf("\n");

printf("\n======================================");
printf("\n");
printf("\nLYDIA'S STORE PAYROLL SYSTEM IN C");
printf("\n");
printf("\n======================================");

printf("\n\n");
printf ( "1. ADD EMPLOYEE RECORDS" ) ;
printf("\n");
printf ( "2. DISPLAY EMPLOYEE RECORDS" ) ;
printf("\n");
printf ( "3. UPDATE EMPLOYEE RECORDS" ) ;
printf("\n");
printf ( "4. PRINT EMPLOYEES PAYSLIP" ) ;
printf("\n");
printf ( "5. DELETE EMPLOYEE RECORDS" ) ;
printf("\n");
printf ( "6. QUIT PROGRAM" ) ;
printf("\n\n");
printf ( "SELECT YOUR CHOICE : " ) ;

fflush (stdin) ;
choice = getche( ) ;
switch ( choice )   /* Selection of Options of Employees Payroll System */
{
case '1' :      

fseek ( fp, 0 , SEEK_END ) ;   /* This portion of the code will ADD EMPLOYEE RECORDS */
another = 'Y' ;

while ( another == 'Y' )
{
system("cls");
printf("\n\n");
            printf("=== Add Employees Record in the Database ===");
            printf("\n\n");
printf("Enter Employee ID             : ");
scanf("%s",&info.emp_id);
printf("Enter Employee Name           : ");
fflush (stdin) ;
gets(info.emp_name);
printf("Enter Employee Position       : ");
fflush (stdin) ;
gets(info.position);
printf("Enter Employee Department     : ");
fflush (stdin) ;
gets(info.department);
                    printf("Enter Basic Pay               : ");
scanf("%f",&info.basic_pay);
printf("Enter Allowance               : ");
scanf("%f",&info.allowance);

info.gross_pay = (info.basic_pay+info.allowance);

printf("\n");
printf("Employee's  Gross Pay : PHP %6.2f",info.gross_pay);

printf("\n\n");
printf("Enter Philhealth              : ");
scanf("%f",&info.philhealth);
printf("Enter SSS/GSIS                : ");
scanf("%f",&info.sss_gsis);
printf("Enter Withholding Tax         : ");
scanf("%f",&info.withholding_tax);
printf("Enter PAG-IBIG                : ");
scanf("%f",&info.pag_ibig);

    info.total_deductions = (info.philhealth+info.sss_gsis
                            + info.withholding_tax+info.pag_ibig);

        info.net_pay = (info.gross_pay-info.total_deductions);

   printf("\n");
   printf("Employee's  Total Deductions : PHP %6.2f",info.total_deductions);
   printf("\n\n");
                   printf("Employee's  Net Pay        : PHP %6.2f",info.net_pay);
                   fwrite ( &info, recsize, 1, fp ) ;
   printf("\n\n");
   printf ( "\nAdd another Record (Y/N) " ) ;
   fflush ( stdin ) ;
   another = toupper(getche()) ;
}

break ;

case '2' : /* This portion of the code will VIEW EMPLOYEE RECORDS */

    system("cls");
rewind (fp);
printf("\n");
                printf("=== View of Employee's Records in the Database ===");
                printf("\n");
while ( fread ( &info, recsize, 1, fp ) == 1 ) {
    printf("\n");
            printf("\n Employee ID          : %s",info.emp_id);
        printf("\n Employee Name        : %s",info.emp_name);
    printf("\n Position             : %s",info.position);
    printf("\n Department           : %s",info.department);
    printf("\n Basic Pay            : PHP %6.2f",info.basic_pay);
printf("\n Allowance            : PHP %6.2f",info.allowance);

info.gross_pay = (info.basic_pay+info.allowance);
printf("\n\n");
printf("\n Employee's  Gross Pay   : PHP %8.2f",info.gross_pay);
printf("\n");
printf("\n Philhealth           : PHP %6.2f",info.philhealth);
    printf("\n SSS/GSIS             : PHP %6.2f",info.sss_gsis);
    printf("\n Witholding Tax       : PHP %6.2f",info.withholding_tax);
    printf("\n PAG-IBIG             : PHP %6.2f",info.pag_ibig);
    info.total_deductions = (info.philhealth+info.sss_gsis
                            + info.withholding_tax+info.pag_ibig);

        info.net_pay = (info.gross_pay-info.total_deductions);

printf("\n\n");
printf("Employee's  Total Deductions : PHP %6.2f",info.total_deductions);
printf("\n\n");
            printf("Employee's  Net Pay        : PHP %6.2f",info.net_pay);
    printf("\n\n");
    }
                system("pause");
break ;

case '3' :  /* This portion of the code will UPDATE EMPLOYEE RECORDS */
               rewind (fp);

another = 'Y' ;
while ( another == 'Y' )
{
            system("cls");
            printf("\n");
    printf("=== Update Employee Records in the Database ===");
    printf("\n\n");

printf("\n");

                    printf("Enter Employee ID Number      : ");
scanf("%s",&emp_id);
rewind ( fp ) ;
while ( fread ( &info, recsize, 1, fp ) == 1 )
{
                    if ( strcmp ( info.emp_id, emp_id ) == 0 )
{

                    printf("Enter Employee ID             : ");
scanf("%s",&info.emp_id);
printf("Enter Employee Name           : ");
fflush (stdin) ;
gets(info.emp_name);
printf("Enter Employee Position       : ");
fflush (stdin) ;
gets(info.position);
printf("Enter Employee Department     : ");
fflush (stdin) ;
gets(info.department);
                    printf("Enter Basic Pay               : ");
scanf("%f",&info.basic_pay);
printf("Enter Allowance               : ");
scanf("%f",&info.allowance);

info.gross_pay = (info.basic_pay+info.allowance);

printf("\n");
printf("Employee's  Gross Pay : PHP %10.2f",info.gross_pay);

printf("\n\n");
printf("Enter Philhealth              : ");
scanf("%f",&info.philhealth);
printf("Enter SSS/GSIS                : ");
scanf("%f",&info.sss_gsis);
printf("Enter Withholding Tax         : ");
scanf("%f",&info.withholding_tax);
printf("Enter PAG-IBIG                : ");
scanf("%f",&info.pag_ibig);
/* Solving for total deductions */
    info.total_deductions = (info.philhealth+info.sss_gsis
                            + info.withholding_tax+info.pag_ibig);
    
/* Solving for net pay of the employee */
        info.net_pay = (info.gross_pay-info.total_deductions);

   printf("\n");
   printf("Employee's  Total Deductions : PHP %6.2f",info.total_deductions);
   printf("\n\n");
                   printf("Employee's  Gross Pay        : PHP %6.2f",info.net_pay);
                printf("\n\n");
                printf("Records has been updated in the database.");
                printf("\n\n");
                system("pause");
                 /* This code will save the update record in the binary file */
fseek ( fp, - recsize, SEEK_CUR ) ;
fwrite ( &info, recsize, 1, fp ) ;
break ;
}

                }
             if (strcmp(info.emp_id,emp_id) != 0 )
                    {
                        printf("\n\n");
                        printf("No Record in the Database.");
                        printf("\n");
                        system("pause");
                        break;
                    }

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

break ;

case '4' :  /* This portion of the code will print employees payslip from the database */
                rewind (fp);

another = 'Y' ;
while ( another == 'Y' )
{
            system("cls");
            printf("\n");
    printf("=== Print Employees PaySlip in the Database ===");
    printf("\n\n");
printf("Enter Employee ID       : ");
scanf("%s",&emp_id);


rewind (fp) ;
while ( fread( &info, recsize, 1, fp ) == 1 )
{
/* Retrieve and display the employees record if found 
  from the binary file */
if (strcmp(info.emp_id,emp_id) == 0 )
{

        printf("\n");
            printf("\n Employee ID          : %s",info.emp_id);
        printf("\n Employee Name        : %s",info.emp_name);
    printf("\n Position             : %s",info.position);
    printf("\n Department           : %s",info.department);
    printf("\n Basic Pay            : PHP %6.2f",info.basic_pay);
printf("\n Allowance            : PHP %6.2f",info.allowance);

info.gross_pay = (info.basic_pay+info.allowance);
printf("\n\n");
printf("\n Employee's  Gross Pay   : PHP %8.2f",info.gross_pay);
printf("\n");
printf("\n Philhealth           : PHP %6.2f",info.philhealth);
    printf("\n SSS/GSIS             : PHP %6.2f",info.sss_gsis);
    printf("\n Witholding Tax       : PHP %6.2f",info.withholding_tax);
    printf("\n PAG-IBIG             : PHP %6.2f",info.pag_ibig);
/* Solving for total deductions */
    info.total_deductions = (info.philhealth+info.sss_gsis
                            + info.withholding_tax+info.pag_ibig);
              
/* Solving for net pay of the employee */
        info.net_pay = (info.gross_pay-info.total_deductions);

printf("\n\n");
printf("Employee's  Total Deductions : PHP %6.2f",info.total_deductions);
printf("\n\n");
            printf("Employee's  Gross Pay        : PHP %6.2f",info.net_pay);
    printf("\n\n");

                    system("pause");

                    break;
                }
}

            if (strcmp(info.emp_id,emp_id) != 0 )
                    {
                        printf("\n\n");
                        printf("No Record in the Database.");
                        printf("\n");
                        system("pause");
                        break;
                    }


                printf("\n");    /* Search for another employee record */
printf ( "\n Search Another Student Record (Y/N) : " ) ;
fflush ( stdin ) ;
another = toupper(getche());
}

break ;

case '5' :

another = 'Y' ;  /* This portion of the code will delete the employees record */
while ( another == 'Y' )
{
system("cls");
flag=0;
                    printf("=== Delete Employee Records in the Database ===");
                    printf("\n\n");
printf("Enter Employee ID       : ");
scanf("%s",&emp_id);
printf("\n");

    ft = fopen ( "TEMP.DAT", "wb" ) ;
rewind ( fp ) ;
while ( fread ( &info, recsize, 1, fp ) == 1 )
{
if ( strcmp ( info.emp_id, emp_id ) != 0 )
fwrite ( &info, recsize, 1, ft ) ;
else
                            flag=1;


}


                   /* Cresting a temporary file  to remove the selected employees record */
fclose ( fp ) ;
fclose ( ft ) ;
remove ( "PAYROLL.DAT" ) ;
rename ( "TEMP.DAT", "PAYROLL.DAT" ) ;
fp = fopen ( "PAYROLL.DAT", "rb+" ) ;
    /* If employees record found delete using this code */

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

else if (flag!=1) {
                        printf("\n");
                        printf("Record Not Found in the Database.");
                        printf("\n");
                        system("pause"); /* stdlib.h library being used here  excute DOS command*/

                    }

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

case '6' :    
fclose ( fp ) ;
printf("\n\n");

printf("      Thank You For Using This Program !!!   ");
printf("\n\n");
system("PAUSE");
exit(0);  

}
}
}  /* Last line of code of the employees payroll program in C */

Friday, July 8, 2022

Break Statement in C Programming Language

 A simple program that I wrote to show how to use break statement using  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.

Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg

=================================================


Want to support my channel?

GCash Account

Jake Pomperada



09173084360


Paypal

https://paypal.me/jakerpomperada


Patreon

https://www.patreon.com/jakerpomperada


Thank you very much for your support.




Program Listing

/*break.c

 Author    : Mr. Jake R. Pomperada,BSCS,MAED-IT

 Date      : November 23, 2018  Tuesday 11:48 AM

 Location  : Bacolod City, Negros Occidental

 Website   : http://www.jakerpomperada.com

 Emails    : jakerpomperada@jakerpomperada.com

             jakerpomperada@gmail.com

             jakerpomperada@yahoo.com

             jakerpomperada@aol.com

*/

#include <stdio.h>


int main()

{

int a=0;

printf("\n\n");

printf("\tBreak Statement in C");

printf("\n\n");

for (a=1; a<=10; a++)

{

if (a==8) {

break;

}

printf("\t%4d",a);

}

    printf("\n\n");

    printf("\tThank you for Using This Software.");

    printf("\n\n");

    printf("\tEnd of Program");

    printf("\n\n");

}