default order in set in c++
6.29
include <iostream>
#include <iomanip>
using namespace std;
bool isPrimeHalf(int number)
{
for (int i = 2; i <= number / 2; i++)
if ((number % i) == 0)
return false;
return true;
}
bool isPrimeRoot(int number)
{
for (int i = 2; i <= sqrt(static_cast<float>(number)); i++)
if ((number % i) == 0)
return false;
return true;
}
int main()
{
cout << "All primes between 2 and 1000 is: " << endl;
for (int number = 2; number <= 100000; number++)
{
if (isPrimeHalf(number))
cout << setw(8) << number;
}
cout << endl;
cout << "And now same with other function: " << endl;
for (int number = 2; number <= 100000; number++)
{
if (isPrimeHalf(number))
cout << setw(8) << number;
}
cout << endl;