Wednesday, April 26, 2017

Leap Year Checker Using Two Dimensional Array in C++

Here is a sample program that I wrote a very long time ago while I am teaching in one of the university in Bacolod City, Negros Occidental Philippines in my C++ class. This program will ask the user to give a series of years and then our program will check if the given year is a leap year or not using two dimensional array.  I am using CodeBlocks as my text editor and Dev C++ as my C++ compiler in this sample program. I hope you will find my work useful. Thank you.

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;


 main()
{

int years[2][2];

  cout << "\n\n\t\t\t LEAP YEAR LISTER 1.O";
  cout << "\n\t Created By: Mr. Jake Rodriguez Pomperada,MAED-IT";
  cout << "\n\n";
for (int row=0; row <2; row++) {
    for (int col=0; col <2; col++) {
        cout << "Enter Year :=> ";
        cin >> years[row][col];
    }
}
cout << "\n\n";
// Leap Year
cout << "LIST OF LEAP YEAR";
cout << "\n\n";
for (int row=0; row <2; row++) {
    for (int col=0; col <2; col++) {

if (years[row][col]%4==0)
{
cout << " " << years[row][col] << " ";
}

    }
}

cout << "\n\n";
// not a leap year
cout << "LIST OF NOT A LEAP YEAR";
cout << "\n\n";
for (int row=0; row <2; row++) {
    for (int col=0; col <2; col++) {
        if (years[row][col]%4==0)
{

}
  else {
      cout << " " << years[row][col] << " ";
    }
  }
}
cout << "\n\n";
system("PAUSE");
}


Occurrence of a Number in C++

Here is a sample program that I wrote a very long time ago while I am teaching in one of the university in Bacolod City, Negros Occidental Philippines in my C++ class. This program will count the occurrence of the number.  I am using CodeBlocks as my text editor and Dev C++ as my C++ compiler in this sample program. I hope you will find my work useful. Thank you.

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;


main(void) {
 int items[5];
    int search=0;
    int occur=0,x=0;


    for (int x=0; x<5; x++) {
        cout << "Enter Item No."
            << x+1 << " : ";
        cin >> x[items];
    }

     cout << "\n\n";
     cout <<"Enter Item to search :";
     cin >> search;
    for (x=0; x<5; x++) {
     if (search == x[items]) {
         occur++;

     }

    }
 cout << "\n\n";
     cout << "Number occurence of is "
         << occur << ".";

    if (search != x[items]) {
         cout << "Not Found in the List.";

     }


     cout << "\n\n";
     system("pause");
}

Divide Two Numbers in Turbo Pascal

Here is a sample program that will ask the user to give two numbers and then our program will compute for it's quotient. I am using a user defined function in Turbo Pascal. I hope you will find my work useful. Thank you.

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 divide_two_numbers;
Uses Crt;

Var c,d,results : real;


Function Divide(a,b : real) : real;
begin
  divide := (a/b);
end;

Begin
  Clrscr;
  Writeln;
  textcolor(White);
  Write('Divide Two Numbers in Turbo Pascal');
  Writeln;
  Writeln;
  Write('Enter First Number  : ');
  Readln(c);
  Writeln;
  Write('Enter Second Number : ');
  Readln(d);

  results := Divide(c,d);

  Writeln;
  Writeln;
  Write('The quotient of ',c:5:2, ' and ',d:5:2, ' is ' ,results:5:2, '.');
  Writeln;
  Writeln;
  Write('End of Program');
  Writeln;
  Readln;
End.



Upper Case String Converter in Turbo Pascal

Here is a sample program that I wrote using Turbo Pascal 6 For DOS to ask the users name and then our program will convert the given users name into upper case letters. The code is very easy to understand and use. Thank you.

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 Upper_Case_Convert;
Uses Crt;

Var User_Name,Result : String;


Function StringUpper(s:String):String; 
var 
i:byte; 
begin 
  for i:=1 to length(s) do s[i]:=Upcase(s[i]); 
  StringUpper := s; 
end; 

Begin
  Clrscr;
  Writeln;
  textcolor(White);
  Write('Upper Case Converter in Turbo Pascal');
  Writeln;
  Writeln;
  Write('Enter you Name : ');
  Readln(User_Name);

  Result := StringUpper(User_Name);

  Writeln;
  Writeln;
  Write(' Hello ' ,Result,'.');
  Writeln;
  Writeln;
  Write('End of Program');
  Writeln;
  Readln;
End.




Area of the Square in Visual Foxpro


Here is a sample program that will ask the user to give a length of the side of the square and then the program will compute for the area of the square. I wrote this sample program using Microsoft Visual Foxpro 5.0. I hope you will find my work useful. Thank you.

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


Ok Button   Command1  Click

set decimal to 2
SET FIXED ON

clear

side = val(thisform.text1.value) 
area_square = (side * side);

final_solve= round(area_square,2)

thisform.label4.caption = "The area of the square is " + alltrim(thisform.text3.value)


thisform.text3.value =  final_solve

Clear Button  Command2  Click

thisform.text1.value=""
thisform.text3.value=""
thisform.text1.setfocus
thisform.label4.caption =""


Quit Button Command2  Click

Quit

Area of the Circle in Visual Foxpro

Here is a sample program that will ask the user to give a value in radius and then the program will compute for the area of the circle. I wrote this sample program using Microsoft Visual Foxpro 5.0. I hope you will find my work useful. Thank you.

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

Ok Button   Command1  Click

set decimal to 2
SET FIXED ON

clear

radius = val(thisform.text1.value) 
area = (3.1416 * radius * radius);

final_solve= round(area,2)

thisform.label4.caption = "The area of the circle is " + alltrim(thisform.text3.value)


thisform.text3.value =  final_solve


Clear Button  Command2  Click

thisform.text1.value=""
thisform.text3.value=""
thisform.text1.setfocus
thisform.label4.caption =""


Quit Button Command2  Click

Quit


Sunday, April 23, 2017

Payroll Program in Visual Foxpro

A very simple payroll program that I wrote using Microsoft Visual Foxpro to accept the employees number of days worked and the rate per day and then our program will compute its salary. The code is very basic and easy to understand I am using Microsoft Visual Foxpro 5.0 in writing this program. Thank you.


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


Ok Button   Command1  Click

set decimal to 2
SET FIXED ON

clear
days_worked = val(thisform.text1.value) 

rate_per_day = val(thisform.text2.value) 

solve_salary = (days_worked) * (rate_per_day)

final_solve= round(solve_salary,2)
thisform.label4.caption = "Your salary is Php " + alltrim(thisform.text3.value)


thisform.text3.value =  final_solve


Clear Button  Command2  Click

thisform.text1.value=""
thisform.text2.value=""
thisform.text3.value=""
thisform.text1.setfocus
thisform.label4.caption =""


Quit Button Command2  Click

Quit


Product of Two Numbers in Visual Foxpro

A very simple program that I wrote using Microsoft Visual Foxpro to ask the user to give two numbers and then our program will compute the product of two numbers given by the user. I wrote this code using Microsoft Visual Foxpro 5.0. Thank you.

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

Ok Button   Command1  Click

number_val_1 = val(thisform.text1.value) 

number_val_2 = val(thisform.text2.value) 

solve_product = (number_val_1) * (number_val_2)

thisform.label4.caption = "The product of " + alltrim(str(number_val_1)) + " and " + alltrim(str(number_val_2)) + " is " + alltrim(str(solve_product)) + "."


Clear Button  Command2  Click

thisform.text1.value=""
thisform.text2.value=""
thisform.text1.setfocus
thisform.label4.caption =""


Quit Button Command2  Click

Quit


Positive and Negative Number Checker in Visual Foxpro

Here is a very simple program that I wrote using Microsoft Visual Foxpro to ask the user to give a number and then our program will check and determine if the given number is a POSITIVE or NEGATIVE number based on the given number by our user. The version of Visual Foxpro that I am using in this sample program is 5.0. Thank you.

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

Ok Button   Command1  Click

number_val = val(thisform.text1.value) 

if (number_val >= 0) then
   MESSAGEBOX("The given number is a POSITIVE number.",0,"The Result")
   thisform.text1.value=""
   thisform.text1.setfocus
  else
   MESSAGEBOX("The given number is an NEGATIVE number.",0,"The Result")
   thisform.text1.value=""
   thisform.text1.setfocus
endif   


Clear Button  Command2  Click

thisform.text1.value=""
thisform.text1.setfocus


Quit Button Command2  Click

Quit




Odd and Even Number Checker in Visual Foxpro

Here is a very simple program that I wrote using Microsoft Visual Foxpro to ask the user to give a number and then our program will check and determine if the given number is an ODD or EVEN number based on the given number by our user. The version of Visual Foxpro that I am using in this sample program is 5.0. Thank you.

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

Ok Button   Command1  Click

Remainder = val(thisform.text1.value) % 2

if (Remainder = 0) then
   MESSAGEBOX("The given number is an EVEN number.",0,"The Result")
   thisform.text1.value=""
   thisform.text1.setfocus
  else
   MESSAGEBOX("The given number is an ODD number.",0,"The Result")
   thisform.text1.value=""
   thisform.text1.setfocus
endif   


Clear Button  Command2  Click

thisform.text1.value=""
thisform.text1.setfocus


Quit Button Command2  Click

Quit




Addition of Three Numbers in Visual Foxpro

In this article I would like to share with you a sample program that add the sum of three numbers being given by our user using Microsoft Visual Foxpro as our programming language. The code is very short and easy to understand. I am using Visual Foxpro 5.0 in this sample program. Thank you.

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

Ok Button   Command1  Click

thisform.text4.value= round(val(thisform.text1.value)+val(thisform.text2.value)+val(thisform.text3.value),0)


Clear Button  Command2  Click

thisform.text1.value=""
thisform.text2.value=""
thisform.text3.value=""
thisform.text4.value=""
thisform.text1.setfocus


Quit Button Command2  Click

Quit




Saturday, April 22, 2017

Payroll Program in Turbo Pascal

Here is a sample program that I wrote using Turbo Pascal 6 to ask the user how many days work and the rate per day and our program will compute for the salary of the employee. The code is very simple and easy to understand.  Thank you.

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 Payroll;

Uses Crt;

Var Daily_Rate, No_days_work, salary : Integer;

Begin

  Clrscr;
  Writeln;
  textcolor(white);
  Write('Payroll Program in Turbo Pascal');
  Writeln;
  Writeln;
  Write('How many days worked : ');
  Readln(No_days_work);
  Writeln;
  Write('What is the daily rate : ');
  Readln(Daily_Rate);

  Salary := (No_days_work * Daily_Rate);

  Writeln;
  Write('Your salary is  Php ',salary,'.');
  writeln;
  writeln;
  Write('End of Program');
  Readln;
 End.