本文整理汇总了C++中Primitive::is_prime方法的典型用法代码示例。如果您正苦于以下问题:C++ Primitive::is_prime方法的具体用法?C++ Primitive::is_prime怎么用?C++ Primitive::is_prime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Primitive
的用法示例。
在下文中一共展示了Primitive::is_prime方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test_Primitive
int test_Primitive(int argc, char ** argv)
{
Primitive test;
cout << test.divided_x_y_efficient(atoi(argv[1]), atoi(argv[2])) << endl;
// cout << test.stringToInt(string(argv[1])) << endl;
// cout << test.intToString(atoi(argv[1])) << endl;
// vector<int> A=buildVector(argc, argv);
// vector<int> D;
// test.print_power_set_k_recursive(A, 0, 2, D);
// test.print_power_set_2(A);
// cout << test.divided_x_y_efficient(atoi(argv[1]), atoi(argv[2])) << endl;
// cout << test.add_no_operator(atoi(argv[1]), atoi(argv[2])) << endl;
// vector<int> A(buildVector(argc, argv));
// test.print_power_set_better(A);
// cout << "--------" << endl;
// test.print_power_set_2(A);
// cout << test.parity_best(atoi(argv[1])) << endl;
// cout << test.parity(atoi(argv[1])) << endl;
return 0;
cout << test.is_prime(atoi(argv[1])) << endl;
return 0;
cout << test.sqrt_no_operator(atoi(argv[1])) << endl;
// cout << test.multiply_no_operator(atoi(argv[1]), atoi(argv[2])) << endl;
return 0;
vector<int> result = test.generate_primes_from_1_n(atoi(argv[1]));
for (int i=0; i<result.size(); i++)
cout << result[i] << endl;
return 0;
cout << test.GCD(atoi(argv[1]), atoi(argv[2])) << endl;
return 0;
try
{
// cout << test.convert_base(string(argv[1]), atoi(argv[2]), atoi(argv[3])) << endl;
vector<unsigned int> arr;
for (int i=1; i<argc; i++)
{
arr.push_back(atoi(argv[i]));
}
string s=test.encode_ints_to_string(arr);
cout << s << endl;
vector<unsigned int> result = test.decode_string_to_ints(s);
for (int i=0; i<result.size(); i++)
cout << result[i] << endl;
// cout << endl;
// vector<int> oneset;
// test.print_power_set(arr, 0, oneset);
// cout << test.closest_int_same_bits(atoi(argv[1])) << endl;
}
catch (string & e)
{
cout << e << endl;
}
return 0;
}