Saturday, August 11, 2018

Logical Operators in C++

A very simple program using C++ to show how to use logical operators.

I am currently accepting programming work, it project, school 

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 in my website kindly contact me also in my email address also. Thank you.
My email address are the following jakerpomperada@gmail.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.



Sample Program Output


logical.cpp


#include <iostream>

using namespace std;

int main()
{
    int a=10, b=4, c = 10, d = 20;
 
    // logical operators
 
    // logical AND example
    cout <<"\n\n";
   
    if (a>b && c==d) {
     cout <<"\tA is greater than B AND C is equal to D.\n";
    }
    else {
   cout <<"\tAND condition not satisfied.\n";
   }
   
    // logical AND example
    if (a>b || c==d) {
cout <<"\tA is greater than B OR C is equal to D.\n";
       }
    else 
{
cout <<"\tNeither A is greater than B nor C is equal to D.\n";
    }
    // logical NOT example
    if (!a) {
        cout <<"\tA is zero.\n";
    }
    else {
    cout <<"\tA is not zero.";
  }
cout <<"\n\n";
    return 0;
}

Student's Information System Using Array in C++

A simple database using arrays in C++ I called this program Student's Information System Using Arrays in C++.

I am currently accepting programming work, it project, school 

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 in my website kindly contact me also in my email address also. Thank you.
My email address are the following jakerpomperada@gmail.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.





Sample Program Output


student.cpp

/*
Program name    : Student's Information System Using Array
Author          : Jake Rodriguez Pomperada, BSCS, MAED-IT
Description     : A simple C++ program that enables the user to enter,
                 search, and display student records using Array.
Language         C++
Date            :  August 7, 2018   Tuesday
Location       : Bacolod City, Negros Occidental Philippines.
*/

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

using namespace std;

// The starting point of program execution

int main()
{
  string fname[256], lname[256], address[256];
  double pg[256], mg[256], eg[256], fg[256];
  int search=0;
  int stud_id[200];
  int choice=0;
  
  do
  {
  system("cls");
         /*
         display menu at program startup
         */
         cout << "\n\n";
cout << "\t Welcome !!! ";
         cout << "\n\n";
         cout<<"\t ****** Student's Information System Using Array *********"  <<"\n";
         cout<<"\t *  [1]  Enter new student record(s)                     *"  <<"\n";
         cout<<"\t *  [2]  Display all student record(s)                   *"  <<"\n";
         cout<<"\t *  [3]  Search student record                           *"  <<"\n";
         cout<<"\t *  [4]  About this Program                              *"  <<"\n";
         cout<<"\t *  [5]  Quit Program                                    *"  <<"\n";
         cout<<"\t *********************************************************" ;
         cout <<"\n\n";
         cout<<"\t Select Your Choice : ";
         cin>>choice;

         switch(choice)
         {
              /*
              1st choice is where the user
              enters student's details
              */
              case 1:
              system("cls");
              int num_rec;
              cout<<"** Number of records to be entered **";
              cout <<"\n";
              cout<<"Number : ";
              cin>>num_rec;
              cin.ignore();
                  for (int a=0; a<num_rec; a++)
                  {
                      system("cls");
                      cout<<"Total number of records to be entered "<<num_rec << " : ";
                      cout <<"\n";
  cout<<"Record number : "<<a+1 <<" : ";
                      cout <<"\n";
                      cin.ignore();
                      cout <<"Student ID   : ";
                      cin >> stud_id[a];
                      cin.ignore();
                      cout<<"First name    : ";
                      getline (cin,fname[a]);
                      cout <<"\n";
                      cout<<"Last name     : ";
                      getline (cin,lname[a]);
                      cout <<"\n";
                      cout<<"Address       : ";
                      getline (cin,address[a]);
                      cout <<"\n";
                      cout<<"Student Grading Information";
                      cout << "\n\n";
                      cout<<"Prelim Grade  : ";
                      cin>>pg[a];
                      cout <<"\n";
                      cout<<"Midterm Grade : ";
                      cin>>mg[a];
                      cout <<"\n";
                      cout<<"Endterm Grade : ";
                      cin>>eg[a];
                      fg[a] = (pg[a]*.3+mg[a]*.3+eg[a]*.4);
                   }
                   cout <<"\n";
                   cout<<"Press any key to return to main menu";
                   getch();
               break;


               case 2:
               /*
               2nd choice displays the number
               and the list of records found in the system
               */
               cout<<"** Number of records currently found in the system **" <<"\n";
               cout <<"\n";
               cout<<"# "<<num_rec <<"\n";
               cout<<"Press any key to view the records "<<"\n";
               getch();
               system("cls");
                  for (int a=0; a<num_rec; a++)
                  {
                       cout <<"\n";
   cout<<"Record number : "<<a+1;
                       cout <<"\n";
                       cout << "Student ID No.  : " << stud_id[a];
                       cout <<"\n";
                       cout<<"Student's name : ";
                       cout <<"\n";
                       cout<<lname[a]<<" , "<<fname[a];
                       cout <<"\n";
                       cout<<"Adress :";
                       cout<<address[a];
                       cout <<"\n\n";
                       cout<<"Final grade  : " <<" "<<fg[a];
                       cout <<"\n";
                       cout<<"--------------------------------------------";
                  }
                  cout <<"\n";
                  cout<<"Press any key to return to main menu";
                  getch();
               break;


               case 3:
               /*
               3rd choice enables the user to search
               for the last name of the student
               found in the system
               */
               system("cls");
               cout<<"** Search and display student's details **"<<"\n";
               cout <<"\n";
               cout<<"Type student's ID  : ";
               cin>>search;
               cin.ignore();
                  for (int a=0; a<=num_rec; a++)
                  {
                      if (search==stud_id[a])
                      {
                         cout <<"\n";
cout << "Student ID No. " << stud_id[a];
                         cout << "\n\n";
cout<<"Student's name ";
                         cout<<lname[a]<<", "<<fname[a]<<"\n";
                         cout <<"\n";
cout<<"Adress "<<" ";
                         cout<<address[a];
                         cout <<"\n";
                         cout<<"Final grade "<<"" <<fg[a];
                         cout <<"\n\n";
                         break;
                      }
  else
  {
cout <<"\n\n";
cout<<"** Record not found Try again **"<<"\n";
break;
  }
                  }
                  cout <<"\n";
  cout<<"Press any key to return to main menu"<<"\n";
                  getch();
               break;


               case 4:
               /*
               4th and last choice
               is About the Program
               */
               system("cls");
               cout<<"Progam name     : Student's Information System Using Array"<<"\n";
               cout<<"Author          : Mr. Jake Rodriguez Pomperada, BSCS, MAED-IT"<<"\n";
               cout<<"Description     : A simple C++ program that enables the user to enter, search, and display student details."<<"\n";
               cout<<"Date            : August 7, 2018   Tuesday ";
   cout <<"\n\n";
   cout<<"Press any key to return to main menu"<<"\n";
               getch();
               break;
         }
  }
  while(choice!=5);
return 0;
} // End of Program

Arithmetic Operators in C++

In this article I would like to share with you simple program that I wrote to show how to use basic arithmetic operators in C++. I am using Dev C++ in writing this program.

I am currently accepting programming work, it project, school 

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 in my website kindly contact me also in my email address also. Thank you.
My email address are the following jakerpomperada@gmail.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.


arithmetic.cpp

#include <iostream>
#include<conio.h>

using namespace std;

int main()
{
            int a=0,b=0,c=0,d=0,e=0,f=0,g=0;
            
            cout << "Arithmetic Operators in C++";
            cout << "\n";
            cout<<"\n Enter First Number a : ";
            cin>>a;
            cout<<"\n Enter Second Number b : ";
            cin>>b;
            c=a+b;
            d=a-b;
            e=a*b;
            f=a/b;
            g=a%b;
            cout<<" Addition = "<<c<<"\n";
            cout<<" Subtraction = "<<d<<"\n";
            cout<<" Multiplication = "<<e<<"\n";
            cout<<" Division = "<<f<<"\n";
            cout<<" Modulus = "<<g<<"\n";
            getch();
}

Wednesday, August 1, 2018

Positive and Negative Number Checker Version 2 in JavaScript

Here is the version two of my program to check if the given number in JavaScript is a positive or negative number.

I am currently accepting programming work, it project, school 

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 in my website kindly contact me also in my email address also. Thank you.
My email address are the following jakerpomperada@gmail.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.





Sample Program Output


Program Listing

index.htm

<html>
<head>
<style>
    body {
      font-family:arial;
  background-color:lightgreen;
  font-size:24px;
  font-weight:bold;
      }
</style>
<script>
function num()
{
var no;

no=Number(document.getElementById("no_input").value);

if (no==0) {
alert("The given number " + no + " is positive number.");
document.getElementById("no_input").value="";
document.getElementById("no_input").focus();
}
else if (no>=1) {
 alert("The given number " + no + " is positive number.");
 document.getElementById("no_input").value="";
 document.getElementById("no_input").focus();
}
else
{
 alert("The given number " + no + " is negative number.");
 document.getElementById("no_input").value="";
 document.getElementById("no_input").focus();
}

}
</script>
</head>
<body>
<br>
<h2> Positive and Negative Number Checker </h2>
<br>

Enter any Number: <input id="no_input">
<button onclick="num()">Check</button></br></br>
</body>
</html>


Prompt JavaScript Calculator

In this article I would like to show you how to create a prompt JavaScript calculator. Our program is very simple it will ask the user to give the first value, the second is the operator  addition, subtraction, multiplication and division and then the second value. Our program will display the result on the screen using if else statement in JavaScript.

I am currently accepting programming work, it project, school 

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 in my website kindly contact me also in my email address also. Thank you.
My email address are the following jakerpomperada@gmail.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.



Sample Program Output


Program Listing

index.htm

<html>
  <head>
  <title> JavaScript Calculator </title>
  </head>
  <style>
    body {
      font-family:arial;
  background-color:lightgreen;
  font-size:24px;
  font-weight:bold;
      }
</style>
 <body>
   <script>
      var a = parseInt(prompt("Give first value"));
  var opt= prompt("Give operator");
  var b = parseInt(prompt("Give second value"));
 
  if (opt =='+') {
    add = (a+b);
document.write("The sum of " + a + " and " 
    + b  + " is " + add + ".");
  }
  else if  (opt =='-') {
    sub = (a-b);
document.write("The difference of " + a + " and " 
    + b  + " is " + sub + ".");
  }
  else if  (opt =='*') {
    mul = (a*b);
document.write("The product of " + a + " and " 
    + b  + " is " + mul + ".");
  }
  else if  (opt =='/') {
    div = (a/b);
document.write("The quotient of " + a + " and " 
    + b  + " is " + div + ".");
  }
  else {
    document.write("Invalid Operation !!!");
  }
</script>
  
  </body>
  
 </html>




Sunday, July 29, 2018

Salary Range Checker in C++

In this article I would like to share a sample program that will demonstrate how to use if  - else if statement in C++. I also added exception handling capabilities that will only accept numbers as input values in our program using limits library in C++. I hope you will find my work useful. I am using Dev C++ in developing this program.

I am currently accepting programming work, it project, school 

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 in my website kindly contact me also in my email address also. Thank you.
My email address are the following jakerpomperada@gmail.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.






Sample Program Output


Program Listing

salary.cpp

// salary.cpp
// written by Mr. Jake R. Pomperada, MAED-IT
// July 29, 2018 Sunday



#include <iostream>
#include<limits>

using namespace std;

int main()
{
int salary=0;
char reply;
do {
system("cls");
cout << "\n\n";
cout <<"\tSalary Range Checker in C++";
cout <<"\n\n";
cout << "\tCreated By Mr. Jake R. Pomperada, MAED-IT";
cout << "\n\n";
cout << "\tWhat is your salary : ";
while(!(cin >> salary)){
        cin.clear();
        cin.ignore(numeric_limits<streamsize>::max(), '\n');
        cout << "\tInvalid input.  Try again: ";
        cout << "\n\n";
         cout << "\tWhat is your salary : ";
    }
     if (salary <=0) {
cout <<"\n\n";
cout <<"\tYour salary ranges is very small. Try Again";
}
else if (salary >= 1 && salary <= 999) {
cout <<"\n\n";
cout <<"\tYour salary ranges from PHP 1 to PHP 999.";
}
else if (salary >= 1000 && salary <= 5999) {
cout <<"\n\n";
cout <<"\tYour salary ranges from PHP 1,000 to PHP 5,9999.";
}
else if (salary >= 6000 && salary <= 10999) {
cout <<"\n\n";
cout <<"\tYour salary ranges from PHP 6,000 to PHP 10,999.";
}
else if (salary >= 11000 && salary <= 15999) {
cout <<"\n\n";
cout <<"\tYour salary ranges from PHP 11,000 to PHP 15999.";
}
else if (salary >= 16000 && salary <= 20000) {
cout <<"\n\n";
cout <<"\tYour salary ranges from PHP 16,000 to PHP 20,000.";
}
else
{
cout <<"\n\n";
cout <<"\tYour is above P20,000 and beyond.";
}
cout <<"\n\n";
cout << "\tDo you want to continue (Y/N)? : ";
    cin >> reply;
} while (reply=='Y' || reply=='y');
  cout << "\n\n";
  cout << "\tThank you for using this software";
  cout <<"\n\n";
  cout << "\tEnd of Program";
  cout <<"\n\n";
}