Tuesday, February 14, 2017

Password Security in C

Hi guys in this article I would like to share with you a sample program that I wrote that will ask the user to give a password and check if the given password is valid or not. What is good about this program it does not display the password while the user is type it instead it display the asterisk symbol in order to hide the real password to the user. The code is very simple and short I hope you will find my work useful.  I am using Dev C++ as my C++ compiler in this program. Thank you.

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


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

int main()
{
    char buffer[256] = {0};
    char password[] = "admin";
    char c;
    int pos = 0;

    printf("\n==============================");
    printf("\nPassword Security in C");
    printf("\n==============================");
    printf("\n\n");

     printf("%s", "Give Your Password: ");
    do {
        c = getch();

        if( isprint(c) )
        {
            buffer[ pos++ ] = c;
            printf("%c", '*');
        }
        else if( c == 8 && pos )
        {
            buffer[ pos-- ] = '\0';
            printf("%s", "\b \b");
        }
    } while( c != 13 );

    if( !strcmp(buffer, password) )

    {
        printf("\n\n");
        printf("Password is Accepted.");
        printf("\n\n");
    }
    else
         {
        printf("\n\n");
        printf("Intruder has been detected.");
        printf("\n\n");
    }
        printf("\n\n");
        printf("THANK YOU FOR USING THIS PROGRAM");
        printf("\n\n");
}





Sunday, February 12, 2017

Count Words in C

In this article I would like to share with you a sample program that will ask you to give a string and then our program will count the number of words in the given by the user using C as our programming language. The code is very short and easy to understand. Thank you.

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
 
word.c

#include <stdio.h>
#include <string.h>

#define NIL ' '

int main()
{

    char str[200];
    int count=0,a=0;

    printf("\t COUNT WORDS IN C PROGRAM");
    printf("\n\n");
    printf("\t Written By: Mr. Jake R. Pomperada, MAED-IT");
    printf("\n\n");
    printf("Give a String : ");
    scanf("%[^\n]s",&str);
     for (a=0;str[a] !='\0'; a++)
     {
        if (str[a]==NIL)
            {
              count++;
            }
     }
     printf("\n\n");
     printf("\t Display Results ");
     printf("\n\n");
     printf("The number of words in the given string is %d.",count+1);
     printf("\n\n");
     printf("\t End of Program ");
     printf("\n\n");
     return 0;
}

Sunday, February 5, 2017

Age Checker Using Classes in C++

Here is a sample program that will ask the user to give his or her age and then our program will check and determine if the user is an already an adult or still a minor using classes in C++.

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.


Program Listing


#include <iostream>

using namespace std;

class age {
    int ages;
    public:
     int getdata();
     void display(void);
};


int age:: getdata()
{
    cout << "Enter the age of the person : ";
    cin >> ages;
    if (ages >= 18) {
        cout <<"\n The person is Already an Adult.";
    }
    else
     {
        cout <<"\n The person is Still a Minor.";
    }
 cout << "\n\n";
 system("pause");
}

void age:: display(void)
{
    int value;
    value = getdata();
}


main()
{
    age start;
    start.display();
}



Payroll System in C++ Using Classes

Here is a sample payroll program that I wrote for my programming class before a long time ago that uses object oriented programming approach it uses class to declare, use and process variables in our program. I hope my work is useful to your learning in C++ programming.

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.



Program Listing

#include <iostream>
#include <iomanip>

using namespace std;


class payroll {

    private:

    string name;
    int days_work;
    float rate;
    float solve;

    public :

      int get_info();
      void display_info();
};

 int payroll :: get_info()
 {
     cout << "\t\t Simple Payroll System Using OOP in C++";
     cout << "\n\n";
     cout << "Enter Employees Name     : ";
     getline(cin,name);
     cout << "Enter No. of Days Worked : ";
     cin >> days_work;
     cout << "Enter Daily Rate         : ";
     cin >> rate;
     cout << fixed << setprecision(2);
     solve = (days_work * rate);
 }

 void payroll ::display_info()
    {

     cout << "\n\n";
     cout << "==== DETAILED REPORT =====";
     cout << "\n\n";
     cout << "\nEmployees Name     : " << name;
     cout << "\nEmployees Salay is : $" << solve;
     cout << "\n\n";
     system("pause");
    }


    main() {
        payroll emp;
        emp.get_info();
        emp.display_info();

    }



Swapping of Two Numbers in C++

Here is a sample program that I wrote a long time ago while I'm working as a college professor teaching C++ programming subjects. This type of program will ask the user to give two numbers and then it will swap or interchange the arrangement of the two numbers given by our user. I am using CodeBlocks as my C++ editor and Dev C++ as my C++ compiler all of them are free to download over the Internet. Thank you.

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.


Program Listing

#include <iostream>

using namespace std;

 int temp=0;


class swapping {

    public :
 int values[1];

    int swap_number(int a, int b)
    {
      temp = values[0];
     values[0] =values[1];
     values[1] = temp;
    }
};

 main() {
     swapping numbers;

      cout << "\t\t Swapping of Values 1.0";
    cout << "\n\n";
    cout << "Enter first number : ";
    cin >> numbers.values[0];
    cout << "Enter second number : ";
     cin >> numbers.values[1];
     cout << "Before the Swapping of values ";
     cout << "\n\n";
    cout << numbers.values[0] << " " << numbers.values[1];

     numbers.swap_number(numbers.values[0],numbers.values[1]);

     cout << "\n\n";
     cout << "After the Swapping of values ";
     cout << "\n\n";
     cout << numbers.values[0] << " " << numbers.values[1];
     cout << "\n\n\n";
     system("PAUSE");
}




Saving two values in text file in C++

Here is a simple program that I wrote that will save the two values in a text file using C++ as our programming language. The code is very short and easy to understand.

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.


Program Listing

#include <iostream>
#include <fstream>

 using namespace std;

  class test {
      public:

       int x,y;
  };

  main() {
      test values;
      int solve=0;
   ofstream myfile("result.txt");
  cout << "Enter two numbers : ";
  cin >> values.x >> values.y;
  cout << "\n\n";
  solve = (values.x) + (values.y);
  cout << "The sum is " << solve;
  cout << "\n\n";
  myfile << "\t Result";
  myfile << "\n\n";
  myfile << "The sum is " << solve << ".";
  myfile.close();
  }

Sum of Digits in Visual Basic Net

In this article I would like to share with you a sample program that will ask the user to give a series of numbers and then our program will compute the total sum of digits based on the given number by our user using Visual Basic NET. The code is very short and easy to understand.

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

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim n, sum, r As Integer

        n = Val(TextBox1.Text)

        sum = 0
        While n <> 0
            r = n Mod 10
            sum += r
            n \= 10
        End While
        Label2.Text = " The Sum of Digits is " + sum.ToString() + "."
   End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        End
    End Sub
End Class





Leap Year Checker in Visual Basic NET

Here is a simple program that I wrote in Visual Basic NET that will ask the user to give a year and then our program will check if the given year is a leap year or not a leap year. The code is very short and easy to understand. 

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

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim y As Integer

        y = Val(TextBox1.Text)

        If y Mod 100 = 0 Then
            If y Mod 400 = 0 Then
                Label2.Text = " The year " + y.ToString + " is a Leap Year."
            Else
                Label2.Text = " The year " + y.ToString + " is NOT a Leap Year."
            End If
        Else
            If y Mod 4 = 0 Then
                Label2.Text = " The year " + y.ToString + " is a Leap Year."
            Else
                Label2.Text = " The year " + y.ToString + " is NOT a Leap Year."
            End If
        End If

        
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        End
    End Sub
End Class



Palindrome Number in Visual Basic NET

In this article I would like to share with you a sample program that will ask the user to give a number and then our program written in Visual Basic NET will give if the given number is a Palindrome or Not a Palindrome. The code is very easy to understand and use.

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


Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim num As String
        Dim sum, t, r As Integer


        num = TextBox1.Text

        sum = 0
        t = num
        While num <> 0
            r = num Mod 10
            sum = sum * 10 + r
            num = num \ 10
        End While
        If sum = t Then
            Label2.Text = " The Number " + t.ToString() + " is a Palindrome Number."
        Else
            Label2.Text = " The Number " + t.ToString() + " is NOT a Palindrome Number."
        End If
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        End
    End Sub
End Class



ID Fields Listing in PHP and MySQL

I have encounter a problem regarding how to display a series of numbers in the number or id field in PHP and MySQL when we want to display a series of records in our field. Actually the solution is a very simple looping statement to increment in ascending order every time we at records in our tables here is the solution below. I hope you will find my work useful.  Thank you.

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

<html>
<body>
<style type="text/css">
th,td{
border-width:0px 1px 1px 0px;
}
</style>
<?php
$counter=1;
mysql_connect('localhost','root','') or die(mysql_error());
mysql_select_db('profile')  or die(mysql_error());
$query=mysql_query("select * from user_table ")  or die(mysql_error());
echo'<table border="1" ><th >ID</th><th>Name</th><th>Work</th>';
while($res=mysql_fetch_array($query))
{
  echo'<tr><td>'.$counter.'</td><td>'.$res['name'].'</td><td>'.$res['work'].'</td></tr>';
  $counter++;
}
echo'</table>';
?>
</body>
</html>





Student Enrollment System in PHP and MySQL

In this article I would like to share with you a program that I wrote using PHP and MySQL as my programming language. This program will allow the student to be enrolled in a university or college there are still many things to be improved in this program in my opinion I just want to share with you this one to give anybody some ideas how to create an enrollment system using PHP and MySQL. Thank you.

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




Student Alumni Registration System in PHP and MySQL

Here is a simple program that I wrote in PHP what enables the user to register student as an alumni in the school that he or she graduated. I'm using bootstrap for the layout design for the code is demonstrate how to transfer one record of the student from one table to another table using PHP and MySQL. I hope my work will will help you a lot in your learning in PHP and MySQL application development.  Thank you.

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