I am slowly learning C and C++, and decided after a few lessons to dive in myself without any help. I developed this prime number generator. It seems fast, but I'm wondering if I'm following the best practices for C++, or if I am missing anything important.
#include "stdafx.h"
#include "stdio.h"
bool checkPrime(int Number);
int _tmain(int argc, _TCHAR* argv[])
{
int currentNum;
currentNum = 2;
do {
if (checkPrime(currentNum)) {
printf("%d ", currentNum);
}
currentNum++;
} while (1 == 1);
return 0;
}
bool checkPrime(int Number){
for (int a = 2; a < Number; a++){
if (Number % a == 0) {
return false;
}
}
return true;
}