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