Monday, June 8, 2020

Login Security System in Perl

I wrote this program to show how to make login security system using Perl programming language.

I am currently accepting programming work inventory system, enrollment system, accounting system, payroll system, information system, website design and development using WordPress, 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 City, Negros Occidental I also accepting computer repair, web development using WordPress, Computer Networking, and Arduino Project development at a very affordable price. My personal website is http://www.jakerpomperada.com


My programming website is http://www.jakerpomperada.blogspot.comI am also a book author you can purchase my books on computer programming and information technology in the following links below.https://www.unlimitedbooksph.com/


Program Listing

# login_string.pl
# Author   : Jake R. Pomperada,MAED-IT,MIT
# Date     : April 8, 2020   Wednesday  7;40 PM
# Location : Bacolod City, Negros Occidental
# Email    : jakerpomperada@gmail.com
# Website  : http://www.jakerpomperada.com

sub get_pword {
    use Term::ReadKey;

    my ($prompt) = shift; 
    my $pword;
    my $key;
    local $| = 1;  
    print "$prompt: ";
    ReadMode 4;   
    while( 1 ) {
        while (not defined ($key = ReadKey(-1))) { }
        if(ord($key) == 13) {
            print "\n";       
            last;            
        }
        print '*';
        $pword .= $key;
    }
    ReadMode 0; 
    return $pword; 
}


    back:
    print("\n\n");
    print("\tLogin Security System in Perl");
    print("\n\n");
  
    print("\tEnter Your Username  : ");
    chomp($username=<STDIN>);
   
my $password = get_pword("\tEnter Your Password   " );
    
    $user_check = lc $username;
    $pass_check = lc $password;

    if  ($user_check eq "admin"  && $pass_check eq "123") {
        print("\n\n");
        printf("\tPassword is accepted. Welcome to the system.")
    } else
      {
          print("\n\n");
          printf("\tInvalid Password. Try Again.");
          print("\n\n");
          goto back;
      }
    print("\n\n");
    print("\t\tEnd of Program");
    print("\n\n");

Load HTML File Using AJAX and jQuery

Load HTML File Using AJAX and jQuery

A simple program that I wrote to load the HTML file using AJAX and jQuery.

I am currently accepting programming work inventory system, enrollment system, accounting system, payroll system, information system, website design and development using WordPress, 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 City, Negros Occidental I also accepting computer repair, web development using WordPress, Computer Networking, and Arduino Project development at a very affordable price. My personal website is http://www.jakerpomperada.com


My programming website is http://www.jakerpomperada.blogspot.comI am also a book author you can purchase my books on computer programming and information technology in the following links below.https://www.unlimitedbooksph.com/


Program Listing

test.html

<html>
   <head>
      <title>AJAX in jQuery</title>
      <style>
    body,p {
        font-family: arial;
        font-size:16px;
        font-weight:bold;
        }   
    h2 {
      font-family: arial;
        font-weight:bold;
    }   
</style>
<script src="jquery-3.2.1.min.js"></script>
<script type = "text/javascript" language = "javascript">
         $(document).ready(function() {
            $("#driver").click(function(event){
               $('#stage').load('result.html');
            });
         });
      </script>
   </head>
   <body>
      <h2>Loading the HTML file Using AJAX in jQuery </h2>
      <p>Click on the button to load result.html file:</p>
      <div id = "stage" style = "background-color:cc0;">
         STAGE
      </div>
   <br>
      <input type = "button" id = "driver" 
      title="Click here to load the result.html file."
      value = "Load Data" />
   </body>
</html>


result.html

<html>
<head>
<title>AJAX in jQuery</title>
</head>
<style>
body,p {
        font-family: arial;
        font-size:16px;
        font-weight:bold;
        }   
    h2 {
      font-family: arial;
        font-weight:bold;
    }   
</style>
<body>
  <h2>Successfully loaded the HTML file in the web page.</h2>
    <h2> Created By Jake Rodriguez Pomperada </h2>
 </body>
 </html>



Length a String in jQuery

Length a String in jQuery

A simple program that I wrote using jQuery to find the length of the given string.


I am currently accepting programming work inventory system, enrollment system, accounting system, payroll system, information system, website design and development using WordPress, 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 City, Negros Occidental I also accepting computer repair, web development using WordPress, Computer Networking, and Arduino Project development at a very affordable price. My personal website is http://www.jakerpomperada.com


My programming website is http://www.jakerpomperada.blogspot.comI am also a book author you can purchase my books on computer programming and information technology in the following links below.https://www.unlimitedbooksph.com/


Program Listing

<html>
<head>
<title>Length a String in jQuery</title>
</head>
<script type="text/javascript" src="jquery-3.2.1.min.js">
</script>
<body>
<script type="text/javascript">
$(document).ready(function() { 
var str = "Philippines";
document.write("<h2>Length of a String in jQuery</h2>");
document.write("<h3>Given Text    : " ,str,"</h3>");
count_str = str.length;
document.write("<h3>The Length of the String  : " ,count_str,"</h3>");
});
</script>
</body>
</html>

Remove Vowels in a String in jQuery

I wrote this program to remove the vowels in a given string using jQuery.

I am currently accepting programming work inventory system, enrollment system, accounting system, payroll system, information system, website design and development using WordPress, 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 City, Negros Occidental I also accepting computer repair, web development using WordPress, Computer Networking, and Arduino Project development at a very affordable price. My personal website is http://www.jakerpomperada.com


My programming website is http://www.jakerpomperada.blogspot.comI am also a book author you can purchase my books on computer programming and information technology in the following links below.https://www.unlimitedbooksph.com/


Program Listing

<html>
<head>
<title>Remove Vowels in a String in jQuery</title>
</head>
<script type="text/javascript" src="jquery-3.2.1.min.js">
</script>
<body>
<script type="text/javascript">
   function Remove_Vowels(str) {
  return str.replace(/[aeiouAEIOU]/gi,' ');
  }

$(document).ready(function() { 
var string_given = "Web Development Using jQuery";
document.write("<h2>Remove Vowels in a String in jQuery</h2>");
document.write("<h3>Original String : " ,string_given,"</h3>");
display_results = Remove_Vowels(string_given);
document.write("<h3>The Result  : " ,display_results,"</h3>");
});
</script>
</body>
</html>

Sunday, June 7, 2020

Paano Magiging Computer Programmer

How To Become a Web Developer

My Journey as a Book Author

Switch Statement in Perl

A simple program that demonstrates how to use switch statement using the Perl programming language.

I am currently accepting programming work inventory system, enrollment system, accounting system, payroll system, information system, website design and development using WordPress, 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 City, Negros Occidental I also accepting computer repair, web development using WordPress, Computer Networking, and Arduino Project development at a very affordable price. My personal website is http://www.jakerpomperada.com


My programming website is http://www.jakerpomperada.blogspot.comI am also a book author you can purchase my books on computer programming and information technology in the following links below.https://www.unlimitedbooksph.com/


Program Listing

# switch_example.pl
# Author  : Jake Rodriguez Pomperada,MAED-IT,MIT
# Date    : April 26, 2020  Sunday  2:21 PM
# Email   : jakerpomperada@gmail.com
# Websites : http://www.jakerpomperada.com
#            http://www.jakerpomperada.blogspot.com

use Switch;

print "\n\n";
print "\tSwitch Statement Example ";
print "\n\n";

$var = 10;
@array = (10, 20, 30);
%hash = ('key1' => 10, 'key2' => 20);

switch($var) {
   case 10           { print "\tnumber 100\n" }
   case "a"          { print "\tstring a" }
   case [1..10,42]   { print "\tnumber in list" }
   case (\@array)    { print "\tnumber in list" }
   case (\%hash)     { print "\tentry in hash" }
   else              { print "\tprevious case not true" }
}

Real Fancy in Java

A program was written by my friend Thomas to test real fancy in Java programming language. Thank you Thomas for sharing your code to us.

I am currently accepting programming work inventory system, enrollment system, accounting system, payroll system, information system, website design and development using WordPress, 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 City, Negros Occidental I also accepting computer repair, web development using WordPress, Computer Networking, and Arduino Project development at a very affordable price. My personal website is http://www.jakerpomperada.com

My programming website is http://www.jakerpomperada.blogspot.comI am also a book author you can purchase my books on computer programming and information technology in the following links below.https://www.unlimitedbooksph.com/

Program Listing

SOLUTION 1

/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
     public static void main (String[] args) throws java.lang.Exception
     {
         // your code goes here
         java.io.BufferedReader r = new java.io.BufferedReader
         (new java.io.InputStreamReader (System.in));
         int T = Integer.parseInt(r.readLine());
         for(int l=0;l<T;l++) {
             String st = r.readLine();
             String[] s = st.split(" ");String ans="regularly fancy";
             for(int i=0;i<s.length;i++){
                 if(s[i].equals("not")){ans="Real Fancy";break;}
             }System.out.println(ans);
             }
     }
}

SOLUTION 2

import java.util.*;
import java.lang.*;
import java.io.*;
class Codechef
{
     public static void main (String[] args) throws java.lang.Exception
     {
         try{
             Scanner scan=new Scanner(System.in);
         int t=scan.nextInt();
      scan.nextLine();
         while (t-- > 0) {
             String[] words = scan.nextLine().split(" ");
             String ans = "regularly fancy";
             for (String s : words) {
                 if (s.equals("not")) {
                     ans = "Real Fancy";
                     break;
                 }
             }
             System.out.println(ans);
      }
         }catch(Exception e){
             System.out.println(e);
         }
}
}

Real Fancy in C++

A program was written by my friend Thomas to test real fancy in C++. Thank you Thomas for sharing your code to us.

I am currently accepting programming work inventory system, enrollment system, accounting system, payroll system, information system, website design and development using WordPress, 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 City, Negros Occidental I also accepting computer repair, web development using WordPress, Computer Networking, and Arduino Project development at a very affordable price. My personal website is http://www.jakerpomperada.com

My programming website is http://www.jakerpomperada.blogspot.comI am also a book author you can purchase my books on computer programming and information technology in the following links below.https://www.unlimitedbooksph.com/

Program Listing

/*
Chef was reading some quotes by great people.
Now, he is interested in classifying all the fancy quotes
he knows. He thinks that all fancy quotes which contain
the word "not" are Real Fancy;
quotes that do not contain it are regularly fancy.
You are given some quotes.
For each quote, you need to tell Chef if it is Real Fancy
or just regularly fancy.

https://www.codechef.com/problems/FANCY
*/

#include <iostream>
#include <string>
#include <cstdio>
#include <sstream>

const std::size_t MAX_INPUT_LENGTH = 100;

inline void do_test()
{
  std::string input;
  input.reserve(MAX_INPUT_LENGTH);
  std::getline(std::cin, input);
  std::istringstream iss(input);
  std::string token;
  while (iss >> token)
  {
    if (token == "not")
    {
      std::cout << "Real Fancy\n";
      return;
    }
  }

  std::cout << "regularly fancy\n";
}

int main()
{
  int num_tests;

#ifdef ONLINE_JUDGE
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
#else
  std::freopen("input.txt", "r", stdin);
#endif

  std::cin >> num_tests;
  std::cin.ignore(255, '\n');

  for (int n = 0; n < num_tests; n++)
  {
    do_test();
  }
}





Calculate Average of Numbers Using Array in C


A program written by my friend and fellow software engineer Sir Ernel. Thank you Sir Ernel for sharing your program with us.

I am currently accepting programming work inventory system, enrollment system, accounting system, payroll system, information system, website design and development using WordPress, 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 City, Negros Occidental I also accepting computer repair, web development using WordPress, Computer Networking, and Arduino Project development at a very affordable price. My personal website is http://www.jakerpomperada.com

My programming website is http://www.jakerpomperada.blogspot.comI am also a book author you can purchase my books on computer programming and information technology in the following links below.https://www.unlimitedbooksph.com/

Program Listing


#include <stdio.h>
int main()
{
    int n, i;
    float num[100], sum=0.0, average;
    printf("Enter the numbers of data: ");
    scanf("%d",&n);
    while (n>100 || n<=0)
    {
        printf("Error! number should in range of (1 to 100).\n");
        printf("Enter the number again: ");
        scanf("%d",&n);
    }
   for(i=0; i<n; ++i)
   {
      printf("%d. Enter number: ",i+1);
      scanf("%f",&num[i]);
      sum+=num[i];
   }
   average=sum/n;
   printf("Average = %.2f",average);
   return 0;
}


Paper-Rock and Scissor Game in C

A game called Paper-Rock and Scissors written and given to us by my friend and fellow software engineer Sir Ernel. Thank you so much Sir Ernel.

I am currently accepting programming work inventory system, enrollment system, accounting system, payroll system, information system, website design and development using WordPress, 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 City, Negros Occidental I also accepting computer repair, web development using WordPress, Computer Networking, and Arduino Project development at a very affordable price. My personal website is http://www.jakerpomperada.com

My programming website is http://www.jakerpomperada.blogspot.comI am also a book author you can purchase my books on computer programming and information technology in the following links below.https://www.unlimitedbooksph.com/

Program Listing


/* Paper-Rock and Scissor Game in C */
#include <stdio.h>
int main ()
{
char p1, p2;
printf("\n       Welcome to Rock-Paper-Scissor Game\n");
printf("\nInstructions: \n Enter [r]rock [p]paper [s]scissor \n");
printf ("\n Enter Player 1: ");
do{
scanf("%c",&p1);
if(p1!='p' && p1!='P' && p1!='s' && p1!='S' && p1!='r' && p1!='R')
{
if(p1!='\n')
printf("\a\nInvalid character %c \nPlease enter valid character r,p,s only\n",p1);
}
}
while(p1!='p' && p1!='P' && p1!='s' && p1!='S' && p1!='r' && p1!='R');
printf ("\n Enter Player 2: ");
do {
scanf("%c",&p2);
if(p2!='p' && p2!='P' && p2!='s' && p2!='S' && p2!='r' && p2!='R') {
if(p2!='\n')
printf("\a\nInvalid character %c \nPlease enter valid character r,p,s only\n",p2);
}
}
while(p2!='p' && p2!='P' && p2!='s' && p2!='S' && p2!='r' && p2!='R');
if (((p1=='p')||(p1=='P')) && ((p2=='R') || (p2=='r'))) {
printf ("\n Player 1 Wins !");
printf ("\n Paper Covers Rock");
}
else 
if (((p2=='p') || (p2=='P')) && ((p1=='r') || (p1=='R'))) {
printf ("\n Player 2 Wins !");
printf ("\n Paper Covers Rock");
}
else 
if (((p1=='r') || (p1=='R')) && ((p2=='s') || (p2=='S'))) {
printf ("\n Player 1 Wins !");
printf ("\n Rock Breaks Scissors");
}
else 
if (((p2=='r') || (p2=='R')) && ((p1=='s') || (p1=='S'))) {
printf ("\n Player 2 Wins !");
printf ("\n Rock Breaks Scissors");
}
else 
if (((p1=='s') || (p1=='S')) && ((p2=='p') || (p2=='P'))) {
printf ("\n Player 1 Wins !");
printf ("\n Scissors Cut Paper");
}
else 
if (((p2=='s') || (p2=='S')) && ((p1=='p') || (p1=='P'))) {
printf ("Player 2 Wins !");
printf ("Scissors Cut Paper");
}
else 
if (p1==p2) {
printf ("\n Nobody Wins !");
printf ("\n Both Of You Entered The Same Letters");
}
return 0;
}

Wednesday, June 3, 2020

Temperature Checker in C++

A simple program that I wrote using C++ to ask the user to give a temperature and then the program will check the type of temperature based on the given value of the user using if-else if statement.

I am currently accepting programming work inventory system, enrollment system, accounting system, payroll system, information system, website design and development using WordPress, 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 City, Negros Occidental I also accepting computer repair, web development using WordPress, Computer Networking, and Arduino Project development at a very affordable price. My personal website is http://www.jakerpomperada.com

My programming website is http://www.jakerpomperada.blogspot.comI am also a book author you can purchase my books on computer programming and information technology in the following links below.https://www.unlimitedbooksph.com/

Program Listing

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

using namespace std;

int main()
{
    int temp;
    cout << "Enter temperature: ";
    cin >> temp;
    if((temp>=31)&&(temp<=50))
        cout << "VERY HOT";
    else if((temp>=21)&&(temp<=30))
        cout << "WARM";
    else if((temp>=11)&&(temp<=20))
        cout << "VERY COLD";
    else if((temp>=0)&&(temp<=10))
        cout << "FREEZING";
    getch();
    return 0;
}    

Area of the Triangle in C++

A simple program that I wrote that will ask the user to give base and height value to compute the are of the triangle using a C++ programming language.

I am currently accepting programming work inventory system, enrollment system, accounting system, payroll system, information system, website design and development using WordPress, 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 City, Negros Occidental I also accepting computer repair, web development using WordPress, Computer Networking, and Arduino Project development at a very affordable price. My personal website is http://www.jakerpomperada.com

My programming website is http://www.jakerpomperada.blogspot.comI am also a book author you can purchase my books on computer programming and information technology in the following links below.https://www.unlimitedbooksph.com/

Program Listing

#include<iostream>
#include<cstdlib>

using namespace std;

int main()
{
    double b,h;

    cout<<"Area of a Triangle Solver"<<endl;
    cout<<"base  : "; 
cin>>b;
    cout<<"height: "; 
cin>>h;
    cout<<"area = "
        <<(b*h)/2
        <<" square units "
        <<endl;

    system("pause");
return 0;
}

Linear Search Using C#

A linear search program was written by my friend Tom that uses C# programming language. Thank you Tom for sharing your code to us.

I am currently accepting programming work inventory system, enrollment system, accounting system, payroll system, information system, website design and development using WordPress, 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 City, Negros Occidental I also accepting computer repair, web development using WordPress, Computer Networking, and Arduino Project development at a very affordable price. My personal website is http://www.jakerpomperada.com


My programming website is http://www.jakerpomperada.blogspot.comI am also a book author you can purchase my books on computer programming and information technology in the following links below. https://www.unlimitedbooksph.com/

Program Listing

/*
The program will ask the use to give for example five numbers
and then the program will  ask the user what number to search
and the program will find the number and what position the number
is Located in.

Compiler / IDE: VS 2017 CE
*/

using System;

namespace ConsoleApp1
{
   class Program
   {
     static void Main(string[] args)
     {
       const int N = 5;
       int[] numbers = new int[N];
       int num_to_search;
       string buffer;

       for (int i = 0; i < N; ++i)
       {
         Console.Write($"Enter number #{i+1}: ");
         buffer = Console.ReadLine();
         numbers[i] = int.Parse(buffer);
         Console.WriteLine();
       }
       Console.WriteLine("Enter number to search: ");
       buffer = Console.ReadLine();
       num_to_search = int.Parse(buffer);

       int idx = Array.IndexOf(numbers, num_to_search);
       if (idx == -1)
         Console.WriteLine("Number not found");
       else
         Console.WriteLine($"Found number {num_to_search} at pos {idx}");

       Console.ReadKey();
     }
   }
}



Linear Search Using Modern C++

A linear search program was written by my friend Tom that uses modern C++ approach.

I am currently accepting programming work inventory system, enrollment system, accounting system, payroll system, information system, website design and development using WordPress, 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 City, Negros Occidental I also accepting computer repair, web development using WordPress, Computer Networking, and Arduino Project development at a very affordable price. My personal website is http://www.jakerpomperada.com


My programming website is http://www.jakerpomperada.blogspot.comI am also a book author you can purchase my books on computer programming and information technology in the following links below. https://www.unlimitedbooksph.com/

Program Listing

/*
The program will ask the use to give for example five numbers
and then the program will  ask the user what number to search
and the program will find the number and what position the number
is Located in.
*/

#include <iostream>
#include <vector>
#include <algorithm>

constexpr int N = 5;

int main()
{
   std::vector<int> numbers(N);
   int num_to_search;

   for (int i = 0; i < N; ++i)
   {
     std::cout << "Enter number #" << i + 1 << ": ";
     std::cin >> numbers[i];
     std::cout << '\n';
   }
   std::cout << "Enter a number to search for: ";
   std::cin >> num_to_search;

   //http://www.cplusplus.com/reference/algorithm/find/
   auto it = std::find(numbers.begin(), numbers.end(), num_to_search);
   if (it == numbers.end())
   {
     std::cout << "Number not found";
   }
   else
   {
     //http://www.cplusplus.com/reference/iterator/distance/
     std::cout << "Found at pos: " << std::distance(numbers.begin(), it);
   }
}