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