#ifndef PRIMENUMBERGENERATOR_PRIME_GEN_H #define PRIMENUMBERGENERATOR_PRIME_GEN_H class PrimeNumberGenerator { public: int start; explicit PrimeNumberGenerator(int start) { this->start = start - 1; } int GetNextPrime() { this->start++; while (true) { if (isPrime(this->start)) { return this->start; } else { this->start++; } } } static bool isPrime(int num) { if (num <= 1) { return false; } for (int i = 2; i <= num / 2; i++) { if (num % i == 0) { return false; } } return true; } }; #endif // PRIMENUMBERGENERATOR_PRIME_GEN_H