Thursday, June 27, 2019

Array Basic Input and Output in Ruby

In this article, I would like to share with you a simple program that I wrote using Ruby programming language that will ask the user a series of an integer number and display the given integer number by the user in the screen using one-dimensional arrays. I am using Eclipse PHP IDE as my editor in writing this Ruby script.

If you like my work please click the ads on my website to support my work. I will really appreciate your help. 

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 in 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.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com


Sample Program Output


Program Listing

# array1.rb
# Author   : Jake Rodriguez Pomperada,BSCS,MAED-IT
# Date     : June 24, 2019   Monday 2:21 PM
# Address  : Bacolod City, Negros Occidental
# Tools    : Eclipse IDE and Ruby Version 2.6.3
# Location : Bacolod City, Negros Occidental  
# Website  : http://www.jakerpomperada.com
# Emails   : jakerpomperada@gmai.com and jakerpomperada@yahoo.com


puts "\n\n"
print "\tArray Basic Input and Output in Ruby";
puts "\n\n"

print "\tHow many items?  ";
num_val = gets.chomp
num_val = num_val.to_i;

nums = []

print("\n")   
for number in (1..num_val)
  print "\tValue in Item No. #{number} : ";
  nums[number] = gets.chomp
  nums[number] = nums[number].to_i;
  
 end

print "\n";
print "\t===== List of Given Values ====="
print "\n\n";
print("\t");

for list_down in 1..num_val
   print(" " ,nums[list_down],"");
 end

print "\n\n";
print "\tEND OF PROGRAM";
print "\n\n";




Wednesday, June 26, 2019

Opening a Text File Using C++

A very simple code to open a text file using C++ as my programming language.

I am using Dev C++ as my C compiler in writing this program.

If you like my work please click the ads on my website to support my work. I will really appreciate your help. 

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 in 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.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com




Program Listing

#include <iostream>
#include <fstream>

using namespace std;

int main(){
  fstream file;
  file.open ("example.txt", ios::out | ios::in );
  return 0;
}



Write a Text File in C

A simple program that I wrote using C programming to write a text file. 

I am using Dev C++ as my C compiler in writing this program.

If you like my work please click the ads on my website to support my work. I will really appreciate your help. 

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 in 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.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com



Sample Program Output


Program Listing

/*open_write_read.c
 Author   : Mr. Jake R. Pomperada, MAED-IT
 Tool     : Dev C++ Version 5.11
 Date     : December 2, 2018  Sunday 6:30 AM 
*/

/* Open, write and close a file : */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main()
{
  FILE *fp ;
  char data[100];
    
  printf("\n\n");
  printf("\tText File Opening, Write and Read Example in C");
  printf("\n\n");
    // opening an existing file
    printf( "\tOpening the file write.txt in write mode" ) ;
    printf("\n\n");
    fp = fopen("write.txt", "w") ;
    if ( fp == NULL )
    {
        printf( "Could not open file write.txt" ) ;
        return 1;
    }
    printf("\tEnter some text from keyboard to write in the file write.txt" );  
printf("\n\n"); 
  /* getting input from user */
    while ( strlen ( gets( data ) ) > 0 )
    {
        /* writing in the file */
        fputs(data, fp) ;   
        fputs("\n", fp) ;
    }
    /* closing the file */
  printf("\n");  
  printf("\tClosing the file write.txt") ;
  fclose(fp);
  printf("\n");
  printf("\tData have been written successfully.");
  printf("\n\n");
  printf("\tEND OF PROGRAM");
  printf("\n\n");
  system("pause");

}




Reading a Text File in C Language

In this article, I would like to show you how to read a text file using C programming language. I am using Dev C++ as my C compiler in writing this program.

If you like my work please click the ads on my website to support my work. I will really appreciate your help. 

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 in 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.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com



Sample Program Output


Content of the write.txt


Program Listing

/*read_file.c
 Author    : Mr. Jake Rodriguez Pomperada,BSCS,MAED-IT
 Date      : December 2, 2018  Sunday 11:26 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>
#include <stdlib.h> /* For exit() function */
#include <stdlib.h> /* For system("pause"); statement */
int main()
{
    char c[1000];
    FILE *fptr;
    if ((fptr = fopen("write.txt", "r")) == NULL)
    {
        printf("Error! opening file");
        /* Program exits if file pointer returns NULL. */
        exit(1);         
    }
    /* reads text until newline */
    fscanf(fptr,"%[^\n]", c);
    printf("\n");
    printf("\tReading Data from the file:\n\n%s", c);
    fclose(fptr);
    printf("\n\n");
  printf("\tEND OF PROGRAM");
  printf("\n\n");
  system("pause");
}













Escape Sequences in C Language

In this article, I would like to share with you a sample program that I wrote using C programming language how to use escape sequence in a C program. If you like my work please click the ads on my website to support my work. I will really appreciate your help. 

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 in 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.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com


Sample Program Output


Program Listing

/* escape_sequence.c
   Author   : Jake Rodriguez Pomperada,BSCS,MAED-IT
   Date     : November 19, 2018   6:59 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()
{
printf("\n\tThis\n\tis\n\ta\n\ttest\n\tonly.\n\n\tJake said, \"How are you Julianna?\"");
printf("\n\n");
printf("\tEnd of Program");
printf("\n\n");
}




Enum Statement in C

A very simple program that I wrote to show how to use enum statement in C programming language. If you like my work please click the ads on my website to support my work. I will really appreciate your help. 

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 in 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.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com

Sample Program Output


Program Listing

/* enum_example.c
  Enum Example Program
  Author   : Jake R. Pomperada,MAED-IT
  Tool     : Dev C++ Version 5.11
  Date    : November 19, 2018   Monday  10:25 AM
*/

#include <stdio.h>

int main()
{
enum MONTH {Jan=0,Feb,Mar};
enum MONTH month = Mar;
printf("\n\n");
     printf("\tEnum Program Demonstration");
     printf("\n\n");

  if (month == 0) {
printf("\tValue of January.");
} else if (month == 1) {
printf("\tMonth is February.");
}
if (month == 2) {
printf("\tMonth is March.");
}
printf("\n\n");
     printf("\tEnd of Program");
     printf("\n\n");
}




Sunday, June 16, 2019

Student Subject Grade Solver in PHP

A simple student subject grade solver that I wrote in PHP a very long time an ago while I am still a beginner in PHP programming.

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 in 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.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com


Sample Program Output

Program Listing

index.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Grade Solver</title>
</head>

<body>
<form action="grade_result.php" method="post">
<table width="301" border="1">
  <tr>
    <td width="141">Enter Prelim:</td>
    <td width="144"><label>
      <input type="text" name="txtpre" id="textfield" />
    </label></td>
  </tr>
  <tr>
    <td>Enter Midterm:</td>
    <td><label>
      <input type="text" name="txtmid" id="textfield2" />
    </label></td>
  </tr>
  <tr>
    <td>Enter Semifinal:</td>
    <td><label>
      <input type="text" name="txtsem" id="textfield3" />
    </label></td>
  </tr>
  <tr>
    <td>Enter Final:</td>
    <td><label>
      <input type="text" name="txtfin" id="textfield4" />
    </label></td>
  </tr>
  <tr>
    <td><label>
      <input type="submit" name="submit" id="button" value="Compute" />
    </label></td>
    <td><label>
      <input type="reset" name="clear" id="button2" value="Clear" />
    </label></td>
  </tr>
</table>
<p>&nbsp;</p>
</form>
</body>
</html>


grade_result.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Grade Solver</title>
</head>

<body>
<?php
$pre = $_POST['txtpre'];
$mid = $_POST['txtpre']; 
$sem = $_POST['txtsem'];
$fin = $_POST['txtfin'];

$avg=($pre + $mid + $sem + $fin)/4;

if ($avg <=75)
{
$remarks="POOR";
}
else if (avg<=80)
{
$remarks="NI";
}
else if ($avg<=85)
{
$remarks="GOOD";
}
else if ($avg<=90)
{
$remarks="Excelent";
}
else 
{
$remarks="Outstanding";
}
?>


<table width="348" border="1">
  <tr>
    <td width="174">Prelim Grade:</td>
    <td width="158"><?php echo $pre; ?></td>
  </tr>
  <tr>
    <td>Midterm Grade:</td>
    <td><?php echo $mid; ?></td>
  </tr>
  <tr>
    <td>Semi-Final Grade:</td>
    <td><?php echo $sem; ?></td>
  </tr>
  <tr>
    <td>Final Grade:</td>
    <td><?php echo $fin; ?></td>
  </tr>
  <tr>
    <td>Your Average is:</td>
    <td><?php echo $avg; ?></td>
  </tr>
  <tr>
    <td>Your Remarks is:</td>
    <td><?php echo $remarks; ?></td>
  </tr>
</table>
</body>
</html>