Sunday, June 19, 2016

Hello World in C#

Here is a simple hello world program in C# provided by my friend Dave Marcellana.


 Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com.


My mobile number here in the Philippines is 09173084360.


Program Listing

HelloWorld.cs


using System;


public static class HelloWorld
{
    public static void Main()
    {
        Console.WriteLine("Hello World!");
    } 
}

    

Sum of Odd and Even Numbers in C++

This simple C++ program will compute the sum of odd and even numbers from the given number by the user. 


 Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com.


My mobile number here in the Philippines is 09173084360.



Sample Program Output


Program Listing

#include <iostream>

using namespace std;

int main()
{
    int a=0, number=0, odd_sum = 0, even_sum = 0;

    cout << "Sum of ODD and Even Numbers in  C++";
    cout << "\n\n";
    cout << "Give a number  : ";
    cin >> number;

    for (a = 1; a <= number; a++)
    {
        if (a % 2 == 0)
            even_sum = (even_sum + a);
        else
            odd_sum = (odd_sum + a);
    }
    cout << "==== The Result =====";
    cout << "\n\n";
    cout << "Sum of all odd numbers is " << odd_sum << ".\n";
    cout << "Sum of all even numbers is " << even_sum << ".";
    cout << "\n\n";
    cout << "\t\t End of Program";
    cout << "\n\n";

}


Loan Program in C++ Using Text File

A simple loan program that I wrote using C++ as my programming language to compute the interest rate of a loan of the customer and then it will store in a text file which act as our database.

 Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.


Program Listing

#include <iostream>
#include <iomanip>
#include <fstream>


using namespace std;

main() {

    string name;

    int principal=0;
    int number_months=0;
    float rate=0.00,solve_rate=0.00;

    ofstream file("report.txt");

    cout << "\t  Kwarta Agad Lending Investor";
    cout << "\n\n";
    cout << "Enter Customer Name    :=> ";
    getline(cin,name);
    cout << "\nEnter Amount  Loan   :=> ";
    cin >> principal;
    cout << "\nNumber of Months    :=> ";
    cin >> number_months;
    cout << "\nEnter Rate Per Month :=> ";
    cin >> rate;
    solve_rate = (principal * number_months * rate ) ;
    cout << "\n\n";
    cout << fixed << setprecision(2);
    cout << "The Simple Interest Rate is Php "
         << solve_rate << ".";

    file << "\n\t ======= Kwarta Agad Lending Investor =========";
    file << "\n\n";
    file << "\n\t\t CUSTOMER REPORT";
    file << "\n\n";
    file << "\n Customer Name     : " << name;
    file << "\n Amount   Loan     : " << principal;
    file << "\n Number of Months  : " << number_months;
    file << "\n Rate Per Month    : " << rate;
    file << "\n\n";
    file << fixed << setprecision(2);
    file << "\n Interest Rate is Php " << solve_rate;
    file.close();
    cout << "\n\n";
    system("pause");
}


Greeter Program in C++ Using Text File

This sample program is an class programming activity that I wrote five years ago in my programming class in C++. What does the program will do is to ask the users name and other information and then those information will be process and stored in a text file. This code will teach how to use text file using C++. I hope you will find my work useful.

 Add me at Facebook my address is 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;

main() {

    string name, address;
    int age=0;

    ofstream file("greet.txt");

    cout <<  "\n\t Greeter Version 1.0 ";
    cout << "\n\n";
    cout << "Enter your name         :=> ";
    getline(cin,name);
    cout << "\nEnter your address    :=> ";
    getline(cin,address);
    cout << "\nEnter your age        :=> ";
    cin >> age;

    cout << "\n\n";
    cout << "\nHello " << name << " " << " Welcome to USLS - Bacolod ";
    cout << "\n You home address is " << address;
    cout << "\n You are already " << age
         << " years old.";
    file << "\n\n";
    file << "\n ======== Greeter Version 1.0 =========";
    file << "\n\n";
    file << "\n Hello " << name << " " << " Welcome to USLS - Bacolod ";
    file << "\n You home address is " << address;
    file << "\n You are already " << age
         << " years old.";
    file.close();
    cout << "\n\n";
    system("pause");
}

Volume of a Cube in C

In this article I would like to share with you a sample program that I wrote using C as my programming language. I called this program volume of a cube in c that will ask the user to give the base, length, height of the cube and then our program will compute for it it's volume. The code is very simple I intended my work for beginners in C programming.

 Add me at Facebook my address is 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 <conio.h>

int main()
{
    int length=0, base =0, height=0, volume=0;
    printf("Volume of a Cube in C");
    printf("\n\n");
    printf("Give the value in length   : ");
    scanf("%d",&length);
    printf("Give the value in base     : ");
    scanf("%d",&base);
    printf("Give the value in height   : ");
    scanf("%d",&height);

    volume = (length * base * height);

    printf("==== The Result =====");
    printf("\n\n");
    printf("The volume of the cube is %d.",volume);
    printf("\n\n");
    printf("\t\t End of Program");


}



Sunday, June 12, 2016

Square Root and Absolute Value in C++

A square root and absolute value in C++ program that I wrote a long time ago in my programming class in college. The code is very easy to understand and learn for beginners that are new in C++ programming.

 Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.


Program Listing

#include <iostream>
#include <math.h>

using namespace std;

class square_root {
    public:
    int value;

};


main() {
     square_root number;

      cout << "\t\t Square Root and Absolute Value Solver 1.0 ";
      cout << "\n\n";
      cout << "Enter A Number : ";
      cin >> number.value;
      cout << "\n\n";
      cout << "The Square Root Value of "
           << number.value << " is " << sqrt(number.value) << ".";
      cout << "\n";
      cout << "The Absolute Value of "
           << -number.value << " is " << abs(number.value) << ".";
      cout << "\n\n";
      system("pause");
}


Bubble Sort in C

A simple program that I wrote in C language that demonstrate bubble sort algorithm. The code is very straight forward and easy to understand.

 Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.



Sample Program Output


Program Listing

bubble.c

#include <stdio.h>
#include <stdlib.h>


int main()
{
  int items[1000], num=0, a=0, b=0, change=0;

  system("cls");

  printf("\t Bubble Sort Program in C");
  printf("\n\n");
  printf("How many items?  : ");
  scanf("%d", &num);
  printf("\n\n");

  for (a= 0; a < num; a++) {
     printf("Enter item no. %d: ", a+1);
    scanf("%d", &items[a]);
  }
   printf("\n\n");
   printf("Original Arrangement of Numbers");
   printf("\n\n");
  for ( a = 0 ; a < num ; a++ ) {
     printf(" %d ", items[a]);
  }

  for (a = 0 ; a < ( num - 1 ); a++)
  {
    for (b = 0 ; b < num - a - 1; b++)
    {
      if (items[b] > items[b+1])
      {
        change       = items[b];
        items[b]   = items[b+1];
        items[b+1] = change;
      }
    }
  }
  printf("\n\n");
  printf("Asceding Order of Numbers");
  printf("\n\n");
  for ( a = 0 ; a < num ; a++ ) {
     printf(" %d ", items[a]);
  }
printf("\n\n");
printf("End of Program");
printf("\n\n");
system("pause");
}

Print Odd Numbers From 1 To 100 in C++

This simple program will display odd numbers from 1 to 100 the code is very simple and easy to understand using C++.


 Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.



Sample Program Output


Program Listing

odd.cpp


#include <iostream>
#include <stdlib.h>

using namespace std;

int main()
{
    cout << "Print Odd Numbers from 1 to 100";
    cout << "\n\n";
     for (int a=1; a<=100; a+=2) {
        cout << " " << a << " ";
     }
    cout << "\n\n";
    cout << "End of Program";
    cout << "\n\n";
    system("pause");
}

Money Bills Denomination in C++

A simple program that I wrote using C++ that will ask the amount from the user and then our program will count how many one thousand, five hundred, two hundred, one hundred, fifty and twenty bills based here in the Philippines. The code is very easy to understand and use I hope you will find my work useful.

 Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.



Sample Program Output

Program Listing

bills.cpp


#include <iostream>
#include <stdlib.h>

using namespace std;

int main()
{

    int amt=0,thousand=0,five_hund=0,two_hundreds=0;
    int hundreds=0,fifty=0,twentys=0;

    cout << "Money Bill Denominator";
    cout << "\n\n";
    cout << "Enter an Amount : ";
    cin >> amt;

    thousand = amt/1000;
    amt = amt%1000;
    five_hund = amt/500;
    amt = amt%500;
    two_hundreds = amt/200;
    amt = amt%200;
    hundreds = amt/100;
    amt = amt%100;
    fifty = amt/50;
    amt = amt%50;
    twentys = amt/20;
    amt = amt%20;

    cout << "\n\n";
    cout << "Display Report";
    cout << "\n";
    cout << "Number of 1000 Notes " << thousand << ".\n";
    cout << "Number of 500 Notes " << five_hund << ".\n";
    cout << "Number of 200 Notes " << two_hundreds << ".\n";
    cout << "Number of 100 Notes " << hundreds << ".\n";
    cout << "Number of 50 Notes " << fifty << ".\n";
    cout << "Number of 20 Notes " << twentys << ".\n";
    cout << "\n\n";
    cout << "End of Program";
    cout << "\n\n";
    system("pause");
}




Sunday, June 5, 2016

Addition of Two Numbers Using Pointers in C

This simple program that I wrote using C programming language will ask the user to give two numbers and then our program will compute the sum of the two numbers using pointers as our data structure. The code is very easy to understand and use.

 Add me at Facebook my address is 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 <stdlib.h>

int first=0,second=0, *a, *b, sum=0;

int main()
{
    printf("Addition of Two Numbers Using Pointers in C");
    printf("\n\n");
    printf("Enter First Value  : ");
    scanf("%d",&first);
    printf("Enter Second Value : ");
    scanf("%d",&second);

    a=&first;
    b=&second;

    sum=(*a+*b);

    printf("\n\n");
    printf("The sum of %d and %d is %d.",first,second,sum);
    printf("\n\n");
    system("pause");
}







Hello World Program in C++

One of the most common sample program that is being presented by teachers in computer program is the Hello World program. In this example I am sharing with you a hello world program written in C++ programming language this program is intended for those people that are very new in C++ programming. It only display a message "Hello World in C++." on the screen of the computer.

 Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360



Sample Program Output


Program Listing

hello.cpp

#include <iostream>
#include <stdlib.h>

using namespace std;

int main()
{
    cout << "Hello World in C++.";
    cout <<"\n\n";
    system("pause");
}


Hello World in C

One of the most common sample program that is being presented by teachers in computer program is the Hello World program. In this example I am sharing with you a hello world program written in C programming language this program is intended for those people that are very new in C programming. It only display a message "Hello World in C Language." on the screen of the computer.

 Add me at Facebook my address is 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 <stdlib.h>

int main()
{
    printf("Hello World in C Language.");
    printf("\n\n");
    system("pause");
}






Saturday, June 4, 2016

Sum of First And Last Number Program Using JSTL and JSP

A simple program that will ask the user three integer number and then our program will find the sum of the first and the last number using Java Server Pages Standard Tag Library or JSTL.

 Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360


Sample Program Output

Program Listing

sum_digits.jsp


<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<html>
<head>
<title>SUM OF FIRST AND LAST NUMBER PROGRAM JSTL</title>
</head>
<style>
body {
font-family: arial;
font-weight: bold;
size: 12px;
color: blue;
}
</style>
<script>
function clear() {
document.getElementById("one").value = "";
}
</script>
<body>
<h2>SUM OF FIRST AND LAST NUMBER PROGRAM IN JSTL</h2>
<br>
<form name="form" method="post">
Enter three numbers Number &nbsp; &nbsp; <input type="text" id="one"
name="one" size="3" value=""" autofocus/><br> <br> <br>
<input type="submit" value="Compute"
title="Click here to findout the first and last numbers." /> <input
type="submit" onclick="clear()" value="Clear"
title="Click here to clear textbox." /> <br />
</form>
<c:if test="${pageContext.request.method=='POST'}">


<c:set var="first" scope="session" value="${ (param.one /100) }" />
<c:set var="last" scope="session" value="${ (param.one % 10) }" />

<c:set var="sum" scope="session" value="${ (first + last) }" />

The sum of the first and last number is 
<fmt:formatNumber value="${sum}" maxFractionDigits="0" />.
<c:remove var="param.one" />
</c:if>
</body>
</html>