Learn Computer Programming Free from our source codes in my website.
Sponsored Link Please Support
https://www.techseries.dev/a/27966/qWm8FwLb
https://www.techseries.dev/a/19181/qWm8FwLb
My Personal Website is http://www.jakerpomperada.com
Email me at jakerpomperada@gmail.com and jakerpomperada@yahoo.com
Saturday, April 10, 2021
General Average Grade Solver With Remarks in C++
A simple program to compute the average grade of the student with remarks that I wrote using C++ programming language.
My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com
Program Listing
// general_average.cpp
// Author : Jake Rodriguez Pomperada,MAED-IT, MIT
// Website : www.jakerpomperada.com / www.jakerpomperada.blogspot.com
// Date : April 10, 2021 Saturday 9:30 AM
// Email : jakerpomperada@gmail.com
#include <iostream>
#include <string.h>
using namespace std;
// Prelim - 0.20, Midterm - 0.30, Finals = 0.50
int main()
{
int prelim=0, midterm=0,finals=0;
int solve_grade;
char subject[100];
cout <<"\n\n";
cout <<"\tGeneral Average Grade Solver With Remarks in C++";
cout <<"\n\n";
cout <<"\tSubject Name : ";
gets(subject);
cout <<"\tEnter Prelim Grade : ";
cin >> prelim;
cout <<"\tEnter Midterm Grade : ";
cin >> midterm;
cout <<"\tEnter Final Grade : ";
cin >> finals;
solve_grade = (prelim * 0.2) +
(midterm * 0.3) +
(finals * 0.5);
cout <<"\n\n";
cout << "\tSubject : " << subject;
cout <<"\n\n";
cout <<"\tYou general average grade is "
<< solve_grade <<".";
cout << "\n\n\n";
if (solve_grade >= 75) {
cout << "\tYou Passed the Subject this semester.";
} else {
cout << "\tYou Failed the Subject this semester.";
}
cout <<"\n\n";
cout <<"\tEnd of the Program";
}
Simple Inventory System in PHP
Here is a simple inventory system in PHP that I wrote I hope you will like it.
My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com
Thursday, April 8, 2021
Saving a Text in a Text File in C++
A simple program that I wrote in C++ to save a text file I hope you will find my work useful.
#include <iostream>
#include <fstream>
using namespace std;
main() {
ofstream myfile("test.txt");
myfile << "Saving a Text in a Text File in C++";
myfile.close();
}
Wednesday, April 7, 2021
Quick Sort in C++
A simple program quick sort in C++ program that I wrote while I am learning C++ programming.
My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com
Program Listing
// quick_sort.cpp
// Prof. Jake R. Pomperada, MAED-IT, MIT
// www.jakerpomperada.com / www.jakerpomperada.blogspot.com
// jakerpomperada@gmail.com
// Bacolod City, Negros Occidental Philippines
#include <iostream>
#include <cstdlib>
using namespace std;
void swap_numbers(int *a, int *b)
{
int temp;
temp = *a;
*a = *b;
*b = temp;
}
int Partition(int a[], int low, int high)
{
int pivot, index, i;
index = low;
pivot = high;
for(i=low; i < high; i++)
{
if(a[i] < a[pivot])
{
swap_numbers(&a[i], &a[index]);
index++;
}
}
swap_numbers(&a[pivot], &a[index]);
return index;
}
int RandomPivotPartition(int a[], int low, int high)
{
int pvt, n, temp;
n = rand();
pvt = low + n%(high-low+1);
swap_numbers(&a[high], &a[pvt]);
return Partition(a, low, high);
}
int QuickSort(int a[], int low, int high)
{
int pindex;
if(low < high)
{
pindex = RandomPivotPartition(a, low, high);
QuickSort(a, low, pindex-1);
QuickSort(a, pindex+1, high);
}
return 0;
}
int main()
{
int n=0, i=0;
cout <<"\n";
cout <<"\t\tQuick Sort in C++";
cout <<"\n\n";
cout<<"\tHow many items to be sorted? ";
cin>>n;
int arr[n];
for(i = 0; i < n; i++)
{
cout<<"\tEnter item no. "<<i+1<<": ";
cin>>arr[i];
}
cout <<"\n";
cout<<"\tUnSorted Items\n ";
cout <<"\n";
cout <<"\t";
for (i =0; i < n; i++) {
cout<<" ,"<<arr[i];
}
cout <<"\n";
QuickSort(arr, 0, n-1);
cout <<"\n\n";
cout<<"\tSorted Item \n";
cout <<"\n";
cout <<"\t";
for (i = 0; i < n; i++) {
cout<<" ,"<<arr[i];
}
cout <<"\n\n";
cout <<"\tEnd of Program";
cout <<"\n";
}
Tuesday, April 6, 2021
Asterisk Triangle in Java
A simple program that will ask the user to give a number and then the program will generate the asterisk triangle using Java programming language.
My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com
Program Listing
/* Asterisk.java
* Author : Jake Rodriguez Pomperada, MAED-IT, MIT
* April 5, 2021 8:13 PM
* www.jakerpomperada.blogspot.com
* www.jakerpomperada.com
* jakerpomperada@gmail.com
* Bacolod City, Negros Occidental
*/
import java.util.Scanner;
public class Asterisks {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.println();
System.out.print("\tAsterisk Triangle in Java");
System.out.println("\n");
System.out.print("\tEnter a number: ");
int number = scan.nextInt();
int res;
System.out.println("\n");
for (int a=1; a<=number; a++) {
System.out.print("\t");
res = number - a;
for (int b=0; b<=res;b++) {
System.out.print("*");
}
System.out.println("");
}
}
}
Money Denomination Checker in PERL
Machine Problem
Create and design a program that will ask the amount from the user and then our program will count how many one thousand, five hundred, two hundred, one hundred, fifty and twenty bills based here in the Philippine currency.
My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com
Sum and Product of Two Numbers in PERL
Machine Problem
Create and design a program that will ask the user to give two numbers and then the program will compute the sum and product of the given numbers and display the results on the screen.
Monday, April 5, 2021
Decimal To Roman Numeral in C++
A simple program that will ask the user to give a number in decimal and convert it into Roman Numeral Equivalent using C++ programming language.
My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com
Program Listing
// roman.cpp
// Prof. Jake R. Pomperada, MAED-IT,MIT
// www.jakerpomperada.com / www.jakerpomperada.blogspot.com
// jakerpomperada@gmail.com
// Bacolod City, Negros Occidental Philippines
#include <iostream>
#include <string>
using namespace std;
string decimal_to_roman(int x) {
int dec[13] = {1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1};
string num[13] = {"M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"};
string numeral;
for(int i = 0; i < 13; i++) {
while (x >= dec[i]) {
x -= dec[i];
numeral.append(num[i]);
}
}
return numeral;
}
int main() {
int decimal=0;
cout <<"\n\n";
cout <<"\tDecimal To Roman Numeral in C++";
cout <<"\n\n";
cout << "\tGive a Number : ";
cin >> decimal;
cout << "\n";
cout << "\tThe given number is " << decimal;
cout << "\n";
cout << "\tThe Roman Numeral Value is "<< decimal_to_roman(decimal);
cout << "\n\n";
cout <<"\tEnd of Program";
}
Password in C++
My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com
Program Listing
password.cpp
// password.cpp
// Prof. Jake R. Pomperada, MAED-IT,MIT
// www.jakerpomperada.com / www.jakerpomperada.blogspot.com
// jakerpomperada@gmail.com
// Bacolod City, Negros Occidental Philippines
#include <iostream>
#include <string>
using namespace std;
int main()
{
string password = "123";
string passwordEntry;
int attempts = 0;
cout <<"\n\n" ;
cout << "\tPassword in C++\n\n";
cout << "\tPlease enter your password: ";
getline(cin, passwordEntry, '\n');
while ( passwordEntry != password && attempts <=2 )
{
cout << "\n";
cout <<"\tPassword Attempt No. : " <<attempts+1;
cout << "\n";
cout << "\tEnter Password Again : ";
getline(cin, passwordEntry, '\n');
attempts++;
}
if ( passwordEntry == password && attempts <=3 )
{
cout << "\n";
cout << "\tAccess Granted in the System.";
}
else
{
cout << "\n";
cout << "\tSorry, you are only allowed 3 password login attempts.";
cout << "\n\n";
}
}