Saturday, October 8, 2016

Search a String To Another String in C

A simple program that I wrote to search a string or a word to another string using C language. The code is very simple 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 <stdio.h>
#include <conio.h>
#include <string.h>
#include <stdlib.h>

int xstrsearch ( char *, char * ) ;
void show( ) ;

int main( )
{
char s1[ ] = "PomperadaJake" ;
char s2[ ] = "Jake" ;
int pos ;

system("cls");
printf("Search a String To Another String in C")
         printf("\n\n");
printf ( "String One: %s\n", s1 ) ;

printf ( "String Two: %s\n", s2 ) ;

pos = xstrsearch ( s1, s2 ) ;
printf ( "\nThe pattern string is found at position: %d\n", pos ) ;

getch( ) ;
}


int xstrsearch ( char * s1, char * s2 )
{
int i, j, k ;
int l1 = strlen ( s1 ) ;
int l2 = strlen ( s2 ) ;

for ( i = 0 ; i <= l1 - l2 ; i++ )
{
j = 0 ;
k = i ;
while ( ( s1[k] == s2[j] ) && ( j < l2 ) )
{
k++ ;
j++ ;
}
if ( j == l2 )
return i ;
}
return -1 ;
}

Friday, October 7, 2016

Square Root in Turbo Pascal

This simple program that I wrote using Turbo Pascal For Windows will accept integer number value from the user and then our program will convert the given number by the user to it's square root equivalent.

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 Square_Root;
Uses WinCrt;


Var   value_a : real;
      solve_sqrt : reAL;

Begin
  Clrscr;
  Write('Square Root Solver in Turbo Pascal');
  writeln;
  Writeln;
  Write('Give a Number : ');
  Readln(value_a);
  Writeln;
   solve_sqrt := sqrt(value_a);
  Write('The Square Root equivalent of ' ,round(value_a),
         ' is ' , round(solve_sqrt), '.');
  writeln;
  Writeln;
  write('End of Program');
  Writeln; Writeln; Writeln;
  Write('      Written By: Mr. Jake R. Pomperada,MAED-IT     ');
  Writeln;
  Readln;
End.



Absolute Value Solver in Turbo Pascal

A simple program that I wrote using Borland International Turbo Pascal For Windows to solve the absolute value of the given negative integer number by the user. The code is very simple 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

Program Absolute_Value_Solver;

Uses WinCrt;


Var   value_a : integer;

Begin
  Clrscr;
  Write('Absolute Value Solver in Turbo Pascal');
  writeln;
  Writeln;
  Write('Give a Number : ');
  Readln(value_a);
  Writeln;
  Write('The absolute value of ',value_a,
        ' is ' , abs(value_a),'.');
  writeln;
  Writeln;
  write('End of Program');
  Writeln; Writeln; Writeln;
  Write('      Written By: Mr. Jake R. Pomperada,MAED-IT     ');
  Writeln;
  Readln;
End.


Interest Rate Calculator in JQuery

A very simple program that I wrote using JQuery as my JavaScript library to compute for the interest rate of the money being loaned by a customer.  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

<html>
<head>
<title> Interest Calculator in JQuery </title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<style>
body {
 background-color:lightgreen;
 font-family: arial;
 font-size:15px;
 font-weight:bold;
 }

 .input_bold {
    font-weight: bold;
font-size:15px;
color: red;
}

.left {
    width: 15%;
    float: left;
    text-align: right;
}
.right {
    width: 50%;
    margin-left: 10px;
    float:left;
}

.header {
    width: 30%;
    float: left;
    text-align: right;
}

h4 {
text-align: center;
}
</style> 
<script>
$(document).ready(function(){

 $("#solve").click(function(){
   
  var amt = $("#amt").val();
  var interest = $("#interest").val();
  var years = $("#years").val();
  
   remarks = (amt*interest*years/100)
$("#results").val('$ ' + remarks.toFixed(2));
 });

   $("#clear").click(function(){

   $("#amt").val('');
   $("#interest").val('');
   $("#years").val('');
    $("#results").val('');
   $("#amt").focus();
    
  });
  
  
 });
  
 </script>
</head>
<body>
<form>
<br><br><br><br>
<div class="header">
<h3> Interest Calculator in JQuery </h3>
<h4>       Written By      </h4> 
<h3> Mr. Jake R. Pomperada, MAED-IT </h3> 
</div>
<br><br><br><br><br><br><br><br>
<div class="left">
Amount Loaned
</div>
<div class="right">
<input type="text" id="amt" size="10" autofocus/><br>
</div>
<br><br>
<div class="left">
Interest Rate 
</div>
<div class="right">
<input type="text" id="interest" size="10" /><br>
</div>
<br><br>
<div class="left">
How many years
</div>
<div class="right">
<input type="text" id="years" size="10" />
</div>
<br><br>
<br>
<div class="left">
The interest is 
</div>
<div class="right">
<input type="text" id="results" class="input_bold" size="30" readonly/><br>
</div>
<br><br><br><br>
<div class="left">
<button type= "button" id ="solve">Check </button>    
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</div>
<div class="right">
<button type= "button" id ="clear">Clear </button> 
<br>

</div>

</form>
</body>
</html>


Absolute Value Solver in Delphi

A simple program that I wrote using Borland International Delphi 7 to solve the absolute value of the given negative integer number by the user. The code is very simple 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

unit abs;

interface

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

type
  TForm1 = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Edit1: TEdit;
    Label3: TLabel;
    Button1: TButton;
    Label4: TLabel;
    Label5: TLabel;
    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_a,solve_a : integer;

procedure TForm1.Button1Click(Sender: TObject);
begin
     value_a := StrToInt(Edit1.Text);
     solve_a := (-value_a);
     Label3.Caption := 'The absolute value of ' + edit1.text
                  + ' is ' + inttostr(solve_a) + '.';

end;

procedure TForm1.Button2Click(Sender: TObject);
begin
Edit1.Text      :='';
Label3.Caption  :='';
Edit1.SetFocus;
end;

end.


Absolute Value Solver in C#

A simple program that I wrote using Microsoft Visual C#.NET to solve the absolute value of the given negative integer number by the user. The code is very simple 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

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication3
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            int abs_value = 0, solve_abs=0;

            if (!int.TryParse(textBox1.Text, out abs_value))
            {
                MessageBox.Show("I need just a number in the textbox.");
                textBox1.Text = "";
                textBox1.Focus();
            }
            
            else
            {
                abs_value = Convert.ToInt32(textBox1.Text);
                solve_abs = Math.Abs(abs_value); label3.Text = "The absolute value of " 
                    + abs_value +" is " + solve_abs + ".";
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            textBox1.Text = "";
            label3.Text = " ";
            textBox1.Focus();
        }
    }
}






Absolute Value Solver in Visual Basic.NET

A simple program that I wrote using Microsoft Visual Basic.NET to solve the absolute value of the given negative integer number by the user. The code is very simple 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 value_a As Integer
        Dim solve_a As Integer

        value_a = Val(TextBox1.Text)

        solve_a = Math.Abs(value_a)

        Label3.Text = "The absolute value of " & value_a & " is " & solve_a & "."

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        TextBox1.Text = ""
        Label3.Text = ""
        TextBox1.Focus()
    End Sub
End Class




Absolute Value Solver in Visual Basic

A simple program that I wrote using Microsoft Visual Basic 5 to solve the absolute value of the given negative integer number by the user. The code is very simple 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

Private Sub Command1_Click()
Dim value_a As Integer

value_a = Abs(Val(Text1.Text))

Label3.Caption = "The absolute value of " & Text1.Text & _
                 " is " & value_a & "."
End Sub


Private Sub Command2_Click()
Text1.Text = ""
Text1.SetFocus
End Sub