
下面是我的代碼,用了miracl庫
extern "C"
{
#include"miracl.h"
#include"mirdef.h"
}
#include <time.h>
int main()
{
int i;
big x, e, m, y;
FILE *fp;
clock_t tBegin, tEnd;
miracl *mip = mirsys(1000, 16);
x = mirvar(0);
e = mirvar(0);
m = mirvar(0);
y = mirvar(0);
fp = fopen("data.txt", "r+");
mip->IOBASE = 16;
cinnum(x, fp);
cinnum(e, fp);
cinnum(m, fp);
fclose(fp);
tBegin = clock();
for (i = 0; i < 100; i ++)
powmod(x, e, m, y);
tEnd = clock();
cotnum(x, stdout);
cotnum(e, stdout);
cotnum(m, stdout);
cotnum(y, stdout);
printf("\n\n進行100次1024位元的模指數運算所消耗的時間為:%ld ms\n\n", tEnd - tBegin);
return 0;
}
大神給看一下,哪出了問題,謝謝
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/90223.html
標籤:基礎類
上一篇:c++和w8怎么兼容
