Monday, February 28, 2022

Remove Duplicate Numbers from vector in C++

Remove duplicate numbers from vector in C++

A  program to remove the duplicate numbers using vectors by the user using a C++ programming language. The program will work on C++ 11 version.

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.

Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg

Thank you very much for your support





 Program Listing

#include <iostream>

#include <algorithm>

#include <vector>


int main()

{

std::cout << "Remove duplicate numbers from vector in C++\n\n";

std::cout << "How many numbers: ";

int numberCount;

std::cin >> numberCount;

std::vector<int> numbers(numberCount);

for (int i = 0; i < numberCount; ++i) {

        std::cout << "Give value in item no " << i+1 << " : ";

std::cin >> numbers[i];

}

std::sort(numbers.begin(), numbers.end());

auto newEnd = std::unique(numbers.begin(), numbers.end());

numbers.resize(std::distance(numbers.begin(), newEnd));

std::cout <<"\n\n";

std::cout << "List of numbers that are not duplicate:\n";

for(int num : numbers) {

std::cout << num << " ";

}

}


Sunday, February 27, 2022

Miles To Kilometers in Python

Miles To Kilometers in Python

 A program that I wrote using Python to ask the user to give distance in miles and then it will convert it into kilometers using Python programming language.

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.

Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg

Thank you very much for your support





Program Listing

# miles_kilometers.py
# Jake Rodriguez Pomperada, MAED-IT, MIT
# www.jakerpomperada.blogspot.com and www.jakerpomperada.com
# jakerpomperada@gmail.com
# Barangay Mandalagan, Bacolod City, Negros Occidental Philippines
print("");
print("\tMiles To Kilometers in Python");
print("");
miles = float(input("Enter Miles Value : "))
#Convert miles to kilometers
milesToKm = float(miles * 1.6)
#Display the result
print("");
print("There are " + str(format(milesToKm,'.2f')) + " Kilometer(s) in " + str(miles) + " Mile(s), ")
print("");
print("End of Program")
print("");

Saturday, February 26, 2022

Remove Duplicate Numbers From An Array in C

Remove Duplicate Numbers From An Array in C

 Machine Problem

Write a C program to remove all duplicate numbers from an array.      It will only display unique numbers on screen after the deletion of all duplicate numbers from an array.

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.

Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg

Thank you very much for your support





Program Listing

#include <stdio.h>

  

 /* 

    Machine Problem

    Write a C program to remove all duplicate numbers from an array.

    It will only display unique numbers on screen after the deletion 

of all duplicate numbers from an array.

*/

    

int main() {

   int arr[100], i=0;

   int j=0, k=0,items=0;

 

   printf("\n");

   printf("\tRemove Duplicate Numbers From An Array in C");

   printf("\n\n");

   printf("\tHow Many Items? : ");

   scanf("%d",&items);

 

   printf("\n");

   for (i = 0; i < items; i++) {

        printf("\tEnter Value in Item No. % : ",i+1);

scanf("%d", &arr[i]);

   }

     

   printf("\n");

   printf("\tList of Numbers That Are Not Duplicate ");

   printf("\n\n");

   for (i = 0; i < items; i++) {

      for (j = i + 1; j < items;) {

         if (arr[j] == arr[i]) {

            for (k = j; k < items; k++) {

               arr[k] = arr[k + 1];

            }

            items--;

         } else

            j++;

      }

   }

   printf("\n");

   printf("\t");

   for (i = 0; i < items; i++) {

      printf("%d ", arr[i]);

   }

    printf("\n\n");

   printf("\tEnd of Program");

   printf("\n");

   return 0;

}

Friday, February 25, 2022

Square and Cube Root Solver in Python

Square and Cube Root Solver in Python

 A simple program to ask the user to give a number and then the program will compute the square and cube root value of the given number using Python programming language.

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.

Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg

Thank you very much for your support.





Program Listing


# square.py
# Jake Rodriguez Pomperada, MAED-IT, MIT
# www.jakerpomperada.blogspot.com and www.jakerpomperada.com
# jakerpomperada@gmail.com
# Barangay Mandalagan, Bacolod City, Negros Occidental Philippines
print("");
print("Square and Cube Root Solver in Python");
print("");
val1 = input("Enter a number : ")
a = int(val1)

def square(a):
return int(a) * int(a)

def cube_root(a):
return int(a) * int(a) * int(a)

print("");

square_result = square(a)
cube_result = cube_root(a)

print("The square value of ", a, " is " ,square_result,'.')
print("The cube root value of ", a, " is " ,cube_result,'.')
print("");
print("End of Program")
print("");


Sum and Product of Five Numbers in C++

Sum And Product Of Five Numbers In C++

 A simple program to solve the sum and product of five numbers using C++ programming language.

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.

Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg

Thank you very much for your support.




Program Listing

// BEGIN CODE


#include <iostream>

#include <algorithm>

#include <numeric>


const std::string ordinal_words[] =

{

     "first", "second", "third", "forth", "fifth"

};


void calculations(int numbers[], int size) {

     int product = 1;


     int sum = 0;


     for (int i = 0; i < size; ++i) {

         product *= numbers[i];

         sum += numbers[i];

     }

     std::cout << "The sum of 5 numbers: " << sum << "\n";


     std::cout << "The product of 5 numbers: " << product << "\n";

}


void four_numbers()

{

     const int NUM_ELEMS = 4;

     int numbers[NUM_ELEMS] = { 0 };


     for (int i = 0; i < NUM_ELEMS; ++i) {

         std::cout << "Enter " << ordinal_words[i] << " number: ";

         std::cin >> numbers[i];

     }

     bool allEqual = std::all_of(numbers + 1, numbers + NUM_ELEMS,

                     [&numbers](int num){return num == numbers[0];} );


     std::cout << (allEqual ?  "true" : "false") << "\n";

}


void five_numbers()

{

     const int NUM_ELEMS = 5;

     int numbers[NUM_ELEMS] = { 0 };


     for (int i = 0; i < NUM_ELEMS; ++i) {

         std::cout << "Enter " << ordinal_words[i] << " number: ";

         std::cin >> numbers[i];

     }

     bool allEqual = std::all_of(numbers + 1, numbers + NUM_ELEMS,

             [&numbers](int num) {

                 return (num == numbers[0]);

             });


     std::cout << (allEqual ? "true" : "false") << "\n";

     calculations(numbers, NUM_ELEMS);

}




int main()

{

     four_numbers();

     five_numbers();


}



Thursday, February 24, 2022

Global and Local Variables in C

Global and Local Variable Declaration in C

 A program to demonstrate how to declare and use local and global variables in C programming language.

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.

Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg

Thank you very much for your support.





Program Listing

/* global_local.c

  Local and Global Variable Program

  Author   : Jake Rodriguez Pomperada, MAED-IT, MIT

  Tool     : Dev C++ Version 5.11

  Date    : February 24, 2022  8:24 PM  Thursday

*/


#include <stdio.h>


// Global variable declaration

//int a = 100;


int main()

{

     // Local variable declaration

    printf("\n\n");

    printf("\tGlobal and Local Variables in C");

    printf("\n\n");

    int a = 50;

    printf("\tThe value is %d.",a);

    printf("\n\n");

    printf("\tEnd of Program");

    printf("\n\n");

    return 0;

}


Wednesday, February 23, 2022

Simple Calculator Using Functions in Python

Simple Calculator Using Functions in Python

 A simple calculator program using functions using Python programming language.

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.

Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg

Thank you very much for your support.







Program Listing

# Simple Calculator Using Functions in Python
# Jake Rodriguez Pomperada, MAED-IT, MIT
# www.jakerpomperada.blogspot.com and www.jakerpomperada.com
# jakerpomperada@gmail.com
# Barangay Mandalagan, Bacolod City, Negros Occidental Philippines

# This function adds two numbers
def add(x, y):
return x + y


# This function subtracts two numbers
def subtract(x, y):
return x - y


# This function multiplies two numbers
def multiply(x, y):
return x * y


# This function divides two numbers
def divide(x, y):
return x / y

choice = input("What mathematical operation do you want to use [+,-,*,/]? ")
num1 = float(input("Enter first number: "))
num2 = float(input("Enter second number: "))
print("\n")

if choice in ('+', '-', '*', '/'):

if choice == '+':
print("The sum of " ,num1, " and ", num2, " is :", add(num1, num2))

elif choice == '-':
print("The difference between " ,num1, " and ", num2, " is : ", subtract(num1, num2))

elif choice == '*':
print("The product between " ,num1, " and ", num2, " is : ", multiply(num1, num2))

elif choice == '/':
print("The quotient of " ,num1, " and ", num2, " is : ", divide(num1, num2))


Sorting Person's Name in C

Sorting Person's Name in C

 A program that will ask the user to give six names of the person and ask the user to sort the names by ascending or descending order using a C programming language.

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.

Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg

Thank you very much for your support.





Program Listing

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


 main()
{
char name[6][100],temp[100];
int a1,i,j,select=0,c=1;

printf("\n");
printf("\tSorting Person's Name in C");
printf("\n");
printf("\nGive Six Names : ");
printf("\n");
for(a1=0;a1<=5;a1++)
{
printf("%d. ",c);
gets(name[a1]);
c++;
}

printf("\n");
printf("\t[1] Sort in Ascending Order   [2] Sort in Descending Order : ");
scanf("%d",&select);
printf("\n");

if (select==1)
 {


  for(i=0;i<6;i++)
  {
   for(j=i+1;j<6;j++)
    {
    if(strcmp(name[i],name[j])>0)
    {
     strcpy(temp,name[i]);
     strcpy(name[i],name[j]);
     strcpy(name[j],temp);
    }
   }
  }
printf("\n");
       printf("\tSorting Names in Ascending Order");
c=1;
for(i=0;i<5;i++)
{

printf("\n%d. %s",c,name[i]);
c++;
}
}
else if(select==2)
{

  for(i=0;i<5;i++)
  {
   for(j=i+1;j<6;j++)
    {
    if(strcmp(name[i],name[j])<0)
    {
     strcpy(temp,name[i]);
     strcpy(name[i],name[j]);
     strcpy(name[j],temp);
    }
   }
  }
printf("\n");
       printf("\tSorting Name's 'Descending Order");
c=1;
for(i=0;i<5;i++)
{

printf("\n%d. %s",c,name[i]);
c++;
}

}
else if(select<=0|| select>=3)
{
printf("\n\Cannot sort Invalid Key!");

}
printf("\n");
printf("\tEnd of Program");
printf("\n");

}

Tuesday, February 22, 2022

Sum,Average, and Product of Three Numbers in Java

Sum,Average, and Product of Three Numbers in Java

 A program that will ask three numbers and then it will compute the sum, average and product of three given numbers using Java programming language.

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.

Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg

Thank you very much for your support.





Program Listing

import java.util.Scanner;


public class LoopSample {


public static void main(String args[]) {



Scanner input = new Scanner(System.in);

double num1=0.00, num2=0.00, num3=0.00;

double sum=0.00, average=0.00, product=0.00;

char c,ch;

     

do 

{

System.out.println();

System.out.println("\tSum,Average, and Product of Three Numbers in Java");

System.out.println();

System.out.print("Enter First Number: ");

num1 = input.nextInt();


System.out.print("Enter Second Number: ");

num2 = input.nextInt();


System.out.print("Enter Third Number: ");

num3 = input.nextInt();


System.out.println();

sum = num1 + num2 + num3;

System.out.println("Sum of these numbers:"+sum);



average = sum / 3;

System.out.println("Average of these number:"+average);



product = num1 * num2 * num3;

System.out.println("Product of these numbers: "+product);


System.out.println();

System.out.print("Do you want to continue? Y/N : ");

c = input.next().charAt(0);        


ch = Character.toUpperCase(c);  

}while (ch == 'Y');  


System.out.println();

System.out.println("Thank you for using this software.");

System.out.println();

input.close();

}




}


Gallons To Liters in Modern C++

Gallons To Liters in Modern C++

 A program that will ask the user to give value in gallons and it will convert to liters using modern C++ programming approach.

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.

Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg

Thank you very much for your support.





Program Listing

// Jake Rodriguez Pomperada, MAED-IT, MIT

// www.jakerpomperada.blogspot.com and www.jakerpomperada.com

// jakerpomperada@gmail.com


#include <iostream>


int main()

{

   int no_gallons=0, no_liters=0;


   std::cout <<"\n\n";

   std::cout << "\tGallons To Liters in Modern C++";

   std::cout <<"\n\n";

   std::cout << "\tHow Many Gallons? : ";

   std::cin >> no_gallons; 


   no_liters = (no_gallons * 4); 

   

   std::cout <<"\n";

   std::cout <<"\t" << no_gallons << " Gallons is equivalent to "

       << no_liters << " Liters.";

   std::cout <<"\n\n";

   std::cout << "\tEnd of Program";

   std::cout <<"\n\n";

  return 0;

}

Sunday, February 20, 2022

Basic Math Operations Using Arrays in Java

Basic Math Operations Using Arrays in Java

 Machine Problem

Creating a Java Program will print the Sum (Addition), Difference (Subtraction), Product (Multiplication), Quotient (Division) of five numbers.

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.

Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg

Thank you very much for your support.




Program Listing


/* basic_math.java

 *  

 *  Jake Rodriguez Pomperada, MAED-IT, MIT

 *  www.jakerpomperada.com and www.jakerpomperada.blogspot.com

 *  jakerpomperada@gmail.com

 *  Bacolod City, Negros Occidental Philippines

 * 

 */


import java.util.Scanner;



public class basic_math {

 

public static void main(String[] args) {

    Scanner input_val= new Scanner(System.in);

int array[] = new int[5];

int a=0,b=0,c=0,d=0,e=0;

     int addition=0,subtraction=0,multiply=0, quotient=0;

        

   

  System.out.println("\n");

  System.out.println("\tBasic Math Operations Using Arrays in Java");

  System.out.println();

      System.out.print("\tInput first number  : ");

      a = array[0]=input_val.nextInt();

      System.out.print("\tInput second number : ");

      b = array[1]=input_val.nextInt();

      System.out.print("\tInput third number  : ");

      c = array[2]=input_val.nextInt();

      System.out.print("\tInput fourth number : ");

      d = array[3]=input_val.nextInt();

      System.out.print("\tInput fifth number  : ");

      e = array[4]=input_val.nextInt();

     

      addition = (a+b+c+d+e);

      subtraction = (a-b-c-d-e);

      multiply = (a*b*c*d*e);

      quotient = (a/b/c/d/e);

      

      System.out.println();

      System.out.println("\tThe sum of " + a + " numbers " + addition);

      System.out.println("\tThe difference of " + a + " numbers " + subtraction);

      System.out.println("\tThe product of " + a + " numbers " + multiply);

      System.out.println("\tThe quotient of " + a + " numbers " + quotient);

      

      

      input_val.close();

}


}