Answers for "default order in set in c++"

C++
0

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;
Posted by: Guest on August-11-2021
0

default order in set in c++

ascending order
Posted by: Guest on August-27-2020

Browse Popular Code Answers by Language