vibrokatana
New Member
I write stupid things all the time like this stupid little c++ app that calculates 200,000 primes (haven't bothered to count tho
):
that should compile in visual studio express if you ever want to run it, it takes about 5-10 minutes depending on the computer tho. If it fails to compile remove the const int line and replace all the variables with the number, VS is rather finicky about variables within array declarations sometimes.

Code:
#include <iostream>
using namespace std;
int main() {
const int NUMTOCALC = 200000;
int primes[NUMTOCALC];
int NumPrimes = 1;
primes[0] = 2;
cout << "Generating primes..." << endl;
for(int i = 2; NumPrimes < NUMTOCALC; ++i) {
bool prime = true;
for(int index = 0; index < NumPrimes; ++index) {
int test = primes[index];
if(!(i % test) || test/2 < index) {
prime = false;
break;
}
}
if(prime) {
primes[NumPrimes++] = i;
cout << i << endl;
}
}
return EXIT_SUCCESS;
}
that should compile in visual studio express if you ever want to run it, it takes about 5-10 minutes depending on the computer tho. If it fails to compile remove the const int line and replace all the variables with the number, VS is rather finicky about variables within array declarations sometimes.
Last edited: