Sunday, December 19, 2021

Largest Element in Diagonal Matrix in C++

 Machine Problem in C++

// Write a program to find the largest element of the main diagonal 

// for an integer matrix: A(4.4) 

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.





Program Listing

// Write a program to find the largest element of the main diagonal // for an integer matrix: A(4.4) #include <iostream> using Matrix = int[4][4]; [[nodiscard]] int max_elem(const Matrix& m) { int max = m[0][0]; for (int row = 1, col = 1; row < 4 && col < 4; ++row, ++col) if (m[row][col] > max) max = m[row][col]; return max; } int main() { Matrix matrix = { { 1, 2, 3, 4 }, { 5, 6, 7, 8 }, { 9, 10, 11, 12 }, { 13, 14, 15, 16 } }; std::cout << "Max elem: " << max_elem(matrix) << "\n"; }

Saturday, December 18, 2021

Simple Do While Loop In PHP

Simple Do While Loop In PHP

 A simple program to show how to declare do while loop statement 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.




Program Listing


<?php

    $output = "";

    if(isset($_POST["number"])){

        $number = $_POST["number"];

        $x = 1;

        do {

            $output .= "$x ";

            $x++;

        } while ($x <= $number);

    }


    if ($output != "") {

        $output = '<p class="text-center mb-1">Your numbers are:</p><h3>'.$output.'</h3>';

    }

?>

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Simple Do While Loop In PHP</title>

    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">

    <style>

        body {

            background-color: #fafafa;

            min-height: 100vh;

            padding: 50px 0;

        }

        form {

            width: 400px;

        }

    </style>

</head>

<body class="d-flex justify-content-center align-items-center text-center">

    <form action="" method="POST" class="card p-2">

        <div class="card-body">

            <h4>Simple Do While Loop In PHP</h4>

            <h5>Jake R. Pomperada, MAED-IT, MIT</h5>

            <hr>

            <div class="my-4">

                <label for="number" class="form-label">Enter a number:</label>

                <input type="number" class="form-control" name="number" id="number">

                <button type="submit" class="btn btn-primary btn-sm btn-block w-100 mt-2">OK</button>

            </div>

            <?php echo $output; ?>

        </div>

    </form>

</body>

</html>

Student Class Record in C++

Student Class Record in C++

* Machine Problem in C++

 *

 * Student Class Record

 * Start by asking the users for a list of students (three or more).

 * The user has 2 options after,view grades and input quiz scores.

 * On view grades, show the average grade of each

 * student (total score/total quiz).

 * On input quiz scores, first ask for the total quiz items.

 * Then ask for the score of each student (you initialized). Done.


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.





Program Listing

/* * grades.cpp * Mr. Jake Rodriguez Pomperada, MAED-IT, MIT * www.jakerpomperada.com and www.jakerpomperada.blogspot.com * jakepomperada@gmail.com * Bacolod City, Negros Occidental Philippines * December 18, 2021 Saturday * * Machine Problem in C++ * * Student Class Record * Start by asking the users for a list of students (three or more). * The user has 2 options after,view grades and input quiz scores. * On view grades, show the average grade of each * student (total score/total quiz). * On input quiz scores, first ask for the total quiz items. * Then ask for the score of each student (you initialized). Done. */ #include <iostream> #include <vector> #include <numeric> class Student { public: void add_score(int score) { m_scores.push_back(score); } double get_avg_score() const noexcept { double sum = std::accumulate(m_scores.begin(), m_scores.end(), 0.0); return sum / m_scores.size(); } private: std::vector<int> m_scores; }; std::vector<Student> enter_scores(int num_students) { int num_scores = 0, temp = 0; std::cout << "How many scores per student: "; std::cin >> num_scores; std::vector<Student> students; for (int j = 0; j < num_students; ++j) { Student student; for (int i = 0; i < num_scores; ++i) { std::cout << "Score " << i + 1 << " for student " << j + 1 << ": "; std::cin >> temp; student.add_score(temp); } students.push_back(student); } return students; } void view_scores(const std::vector<Student>& students) { std::cout << "\n\n"; std::cout << "Students report\n"; std::cout << "===============\n\n"; int count = 1; if (students.empty()) { std::cout << "No students to report.\n"; return; } for (const auto& student : students) { std::cout << "Average score for student " << count++ << '\t' << student.get_avg_score() << "\n"; } } int main() { int num_students = 0, choice = 0; bool finished = false; std::vector<Student> students; std::cout << "\n"; std::cout << "\tStudent Class Record in C++\n"; std::cout << "\n"; std::cout << "Number of students(min 3): "; std::cin >> num_students; if (num_students < 3) { std::cout << "Invalid number of students.\n"; finished = true; } while (!finished) { std::cout << "1 - Enter scores\n2 - View scores\n3 - Exit\n"; std::cout << "Enter your choice: "; std::cin >> choice; if (choice == 1) students = enter_scores(num_students); else if (choice == 2) view_scores(students); else if (choice == 3) finished = true; } }

Thursday, December 16, 2021

Hypotenuse Value of Right Triangle in C++

 /* 3. Summative Assessment 2

Write a C++ program that calculate and displays the hypotenuse value

of right angle triangle. 

There are 2 right triangle base and height measurements:

The  first  triangle's  base  is  3  and  height  is  5 .

The  second  triangle's  base  is  4  and  height  of  8.


Find out the area of each triangle. Use a structure for this program.

The area of a triangle is computed as:


Area  =  0. 5  *  base  *  height

The output should be:


The  first  triangle  hypotenuse  is  5.83095

The  area  of  the  first  triangle  is  7 . 5

The  second  triangle  hypotenuse  is  8.94427

The  area  of  the  first  triangle  is  16

*/


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.






Program Listing

/* 3. Summative Assessment 2 Write a C++ program that calculate and displays the hypotenuse value of right angle triangle. There are 2 right triangle base and height measurements: The first triangle's base is 3 and height is 5 . The second triangle's base is 4 and height of 8. Find out the area of each triangle. Use a structure for this program. The area of a triangle is computed as: Area = 0. 5 * base * height The output should be: The first triangle hypotenuse is 5.83095 The area of the first triangle is 7 . 5 The second triangle hypotenuse is 8.94427 The area of the first triangle is 16 */ #include <iostream> #include <string> #include <cmath> using namespace std; struct triangle { float a, b, c; }; int main() { triangle t1 = { 3, 5 }, t2 = { 4, 8 }; auto hypo1 = sqrt(t1.a * t1.a + t1.b * t1.b); cout << "The first triangle hypotenuse is " << hypo1 << "\n"; auto area1 = 0.5f * t1.a * t1.b; cout << "The area of the first triangle is " << area1 << "\n"; auto hypo2 = sqrt(t2.a * t2.a + t2.b * t2.b); cout << "The second triangle hypotenuse is " << hypo2 << "\n"; auto area2 = 0.5f * t2.a * t2.b; cout << "The area of the second triangle is " << area2 << "\n"; return 0; }

Simple For Loop In PHP

Simple For Loop In PHP

 A simple for loop statement program that I wrote using PHP 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.





Program Listing

<?php $output = ""; if(isset($_POST["number"])){ $number = $_POST["number"]; for ($i=1; $i <= $number; $i++) { $output .= "$i "; } } if ($output != "") { $output = '<p class="text-center mb-1">Your numbers are:</p><h3>'.$output.'</h3>'; } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Simple For Loop In PHP</title> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"> <style> body { background-color: #fafafa; min-height: 100vh; padding: 50px 0; } form { width: 400px; } </style> </head> <body class="d-flex justify-content-center align-items-center text-center"> <form action="" method="POST" class="card p-2"> <div class="card-body"> <h4>Simple For Loop In PHP</h4> <h5>Jake R. Pomperada, MAED-IT, MIT</h5> <hr> <div class="my-4"> <label for="number" class="form-label">Enter a number:</label> <input type="number" class="form-control" name="number" id="number"> <button type="submit" class="btn btn-primary btn-sm btn-block w-100 mt-2">OK</button> </div> <?php echo $output; ?> </div> </form> </body> </html>

Wednesday, December 15, 2021

Addition of Two Numbers Using Two Dimensional Array in C++

Addition of Two Numbers Using Two Dimensional Array in C++

 A simple program to ask the user to ask two numbers and then the program will solve the sum of two given numbers using two dimensional arrays 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.





Program Listing

// Addition of two numbers using two dimensional array // November 1, 2018 Thursday // Author: Mr. Jake R. Pomperada,MAED-IT // www.jakerpomperada.com // jakerpomperada@gmail.com // jakerpomperada@jakerpomperada.com // Product of Bacolod City, Negros Occidental Philippines #include <iostream> using namespace std; int main() { int a[1][1]; char reply; int sum=0; do { cout <<"\n\n"; cout << "Addition of Two Numbers Using Two Dimensional Array in C++"; cout <<"\n\n"; cout << "Enter first number : "; cin >> a[0][0]; cout <<"Enter second number : "; cin >> a[0][1]; sum = (a[0][0]) + (a[0][1]); cout <<"\n\n"; cout << "The total sum is " << sum <<"."; cout <<"\n\n"; cout <<"Do you want to continue? Y/N : "; cin >> reply; } while(toupper(reply)=='Y'); cout <<"\n\n"; cout <<"\tEnd of Program"; cout <<"\n\n"; }

Break Statement in C Programming Language

Break Statement in C

 A simple program to demonstrate how to declare and use the break statement 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.





Program Listing

/*break.c Author : Mr. Jake R. Pomperada,BSCS,MAED-IT Date : November 23, 2018 Tuesday 11:48 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() { int a=0; printf("\n\n"); printf("\tBreak Statement in C"); printf("\n\n"); for (a=1; a<=10; a++) { if (a==6) { break; } printf("\t%4d",a); } printf("\n\n"); printf("\tThank you for Using This Software."); printf("\n\n"); printf("\tEnd of Program"); printf("\n\n"); }

Tuesday, December 14, 2021

Average of Three Numbers in Python

Average of Three Numbers in Python

 

Machine Problem in Python

Write a program that will ask the user to give three numbers and then the program will compute the average of the three numbers 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.






Program Listing

# Jake R. Pomperada, MAED-IT, MIT
# www.jakerpomperada.com and www.jakerpomperada.blogspot.com
# jakerpomperada@gmail.com
# Bacolod City, Negros Occidental Philippines

# Machine Problem in Python
#
# Write a program that will ask the user to give three numbers and then
# the program will compute the average of the three numbers using Python
# programming language.

print()
print("\tAverage of Three Numbers in Python")
print()
a = int (input("Enter the First Number: "))
b = int (input("Enter the Second number: "))
c = int (input("Enter the Third number: "))

average=(a+b+c)/3

print()
print("The average of three numbers is ", average)
print("\n\tEnd of Program")

Monday, December 13, 2021

Simple Multiplication Table Using Arrays in C++

Simple Multiplication Table Using Arrays in C++

 A simple multiplication table using arrays 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.





Program Listing

#include <cstdlib> #include <iostream> #include <iomanip> using namespace std; int main(int argc, char *argv[]) { int values[10] = {1,2,3,4,5,6,7,8,9,10}; int values2[10] = {10,9,8,7,6,5,4,3,2,1}; cout << "\n\n"; cout << " ===== SIMPLE MULTIPLICATION TABLE USING ARRAYS IN C++ ====="; cout << "\n\n Created By: Mr. Jake R.Pomperada,MAED-IT"; cout << "\n\n"; for (int list=0; list <10 ; list++) { cout << "\n"; cout<< setw(2) << list[values] << " x " << setw(2) << list[values] << " = " << setw(2) << list[values] * list[values]; cout<< setw(10) << list[values] << " + " << setw(2) << list[values2] << " = " << setw(1) << (list[values] + list[values2]); } cout << "\n\n"; system("PAUSE"); return EXIT_SUCCESS; }

Sunday, December 12, 2021

Sum and Average of Two Numbers in C++

Sum and Average of Two Numbers in C++

 A simple program to ask the user to give two numbers and then the program will solve the sum and average of the two given 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.






Program Listing

#include <iostream> // sum_average.cpp // Written By: Mr. Jake Rodriguez Pomperada, MAED-IT, MIT // www.jakerpomperada.com and www.jakerpomperada.blogspot.com // jakerpomperada@gmail.com // Bacolod City, Negros Occidental Philippines int main() { float val_one, val_two; float sum, average; std::cout <<"\n"; std::cout << "\tSum and Average of Two Numbers in C++\n\n"; std::cout << "\tEnter First Value : "; std::cin >> val_one; std::cout << "\tEnter Second Value : "; std::cin >> val_two; sum = (val_one + val_two); average = (sum/2); std::cout <<"\n"; std::cout << "\tThe sum is " << sum << ".\n"; std::cout << "\tThe average is " << average << ".\n"; std::cout <<"\n"; }

User Defined Function in C++

User Defined Function in C++

 A simple program to demonstrate how to write user defined function 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.




Program Listing


#include <iostream>


int addition(int a, int b)

{

    return(a+b);

}


int product(int a, int b)

{

    return(a*b);

}


int main()

{

    std::cout <<"\n";

    std::cout << "\tUser Defined Function in C++\n\n";

    std::cout << "\tAddition Function :  " <<addition(2,4) << "\n";

    std::cout <<"\n";

    std::cout << "\tProduct Function  :  " <<product(5,5) << "\n";

    std::cout <<"\n";

}