Here is one more example of some code I whipped up. This program extracts the first 15 positive prime integers starting with 2. A positive prime integer is essentially just a positive number that can only be divided by 1 and itself.
#include <iostream> //Needed to run the program
using namespace std; // Needed to run the program
int main() // Needed to run the program
bool flag = false; //used to flag
for (int i = 2; i < 52; i++) // loop through 50 times
for (int j = 2; j < i; j++) // nested loop that loops 2 to i-1 times
if (i%j == 0) // if the modulus of i and j is 0, the number can't be prime
flag = true; // so mark that the number is not a prime
break; // and break the loop for better effieciency
if (!flag) // if the flag has not been raised
cout << i << endl; // print the i and start a new line
flag = false; // reset the flag to false
return 0; // Needed to run the program
I have also been working on a program that demonstrates cryptology (the study of reading and writing codes.) Cryptology has currently been made popular by the court case between the US government and Apple over the San Bernardino Terrorist attacks. If there is enough interest I might release a step by step, interactive demonstration on how current cryptological systems work.
Thanks for checking my site out!