Basic Python port scanner

This is a basic port scanner implementation in Python; it attempts to connect to the given ports of the specified host (all ports, if none indicated), and outputs to a text file and to the console if a given port is open – if it is, it then attempts to …

Solving a second order linear homogenous recurrence relation with consistent coefficients

#include <iostream> #include <vector> #include <math.h> // Solves for quadratic formula std::vector quadraticCalc(double a, double b, double c); int main(void) { double A = 0, B = 0, Cone, Ctwo; std::vector<double> terms, quadBuff; std::cout << “Enter value for a_(0): “; std::cin >> A; terms.push_back(A); std::cout << std::endl; std::cout << “Enter …

Divide by two to convert decimal to binary

Simple C++ program that converts from decimal to binary by dividing a given number by two repeatedly, saving the remainder to a boolean vector, and then printing the contents of the vector back. #include <iostream> #include <vector> //////////////////////////////////////////////////////////////////////// void printBinary(std::vector passedBool); // std::vector divisionAlgorithm(unsigned long long userInput); // //////////////////////////////////////////////////////////////////////// int …

Asterisk bar graph in Java

When I was learning Java, and one of my assignments was to create a program that generated a vertical bar graph of asterisks given user input. Found it so I figured I’d post it -nothing fancy, just something different /////////////////////////////////////////////////////////////////////////////// import java.io.*; import java.util.Scanner; class LabFour { public static void …

GCD using Euclidean Algorithm

Given two unsigned long long, x and y, such that x is greater than y… Throughout the algorithm, x = (y * quotient) + remainder void gcdCalc(unsigned long long x, unsigned long long y) { unsigned long long remainder; // While y != 0 while(y) { std::cout

Prime factor finder

#include <iostream> #include <vector> #include <math.h> #include &ltalgorithm> int main(void) { // ull is large data type to input large numbers unsigned long long inputNumb, sieveMax; // for holding found numbers; easy way to sort ascending std::vector&ltunsigned long long&gt foundNumbers; // flag for ending division in prime factorization bool divided; …

Full adder simulation

A full adder simulation implementation in C++. It is implemented with a “adder queue” as part of the assignment prerequisites was adding 8 binary strings to a buffer for adding. #include <iostream> #include <vector> #include <algorithm> //////////////////////////////////////////////////////////////////////////////// // Function Prototypes //////////////////////////////////////////////////////////////////////////////// std::string fullAdder(std::vector<std::vector*> adderIn); int userActivity(std::string stringBuff[9], std::vector<std::vector*> &adderInput); void …

Calculating nth Fibonacci number

This is simply an implementation of Binet’s formula in C++; someone had a question regarding calculating Fibonacci numbers from the nth number, backwards, so I created this small program. It calculates Fibonacci numbers from the 50th, down to the 1st, in reverse. Python would allow for greater Fibonacci sequence calculations …

Logical Argument Truth Table Generator

For a discrete mathematics lab, I was required to submit a program that would generate a truth table given two statements and determine it’s validity; if not valid, it will indicate which columns are incorrect. Part of the prerequisite (for simplicity) was hardcoding in the premise and conclusion; this is …