NTL库里函数的使用

NTL库官网

例1:

1.官方文档里对应的函数:

void RandomBits(ZZ& x, long l);

2.编写代码文件Random.cc:      

#include 

using namespace std;
using namespace NTL;

int main(){
	ZZ x;
	long l=45;
	RandomBits(x,l);
	cout<
3.编译 sh test.sh。test.sh文件:
g++ -g -O2 Random.cc -o test -lntl -lgmp -lm

例2:

1.官方文档里对应的函数:

long RandomBits_long(long l);

2.编写代码文件Random.cc:      

#include 

using namespace std;
using namespace NTL;

int main(){
    long x;
    long l=45;
    x=RandomBits_long(l);
    cout<
3.编译 sh test.sh。test.sh文件:
g++ -g -O2 Random.cc -o test -lntl -lgmp -lm





你可能感兴趣的:(NTL)