c++ log()函数报错#include#include#include#includeint main(){freopen("1.txt","w",stdout);srand(time(NULL));int cas=rand()%100+1;int k;while (cas--){k=rand()%16000000+1;int ex=rand()%('z'-'a')+1;int n=(int)(log(k)/log(ex));//此处改为log(1600000
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/28 16:50:27
c++ log()函数报错#include#include#include#includeint main(){freopen("1.txt","w",stdout);srand(time(NULL));int cas=rand()%100+1;int k;while (cas--){k=rand()%16000000+1;int ex=rand()%('z'-'a')+1;int n=(int)(log(k)/log(ex));//此处改为log(1600000
c++ log()函数报错
#include
#include
#include
#include
int main(){
freopen("1.txt","w",stdout);
srand(time(NULL));
int cas=rand()%100+1;
int k;
while (cas--){
k=rand()%16000000+1;
int ex=rand()%('z'-'a')+1;
int n=(int)(log(k)/log(ex));//此处改为log(16000000)/log(ex)就不会报错
printf("%d %d\n",rand()%(n/5)+1,ex+1);
for (int i=0;i
c++ log()函数报错#include#include#include#includeint main(){freopen("1.txt","w",stdout);srand(time(NULL));int cas=rand()%100+1;int k;while (cas--){k=rand()%16000000+1;int ex=rand()%('z'-'a')+1;int n=(int)(log(k)/log(ex));//此处改为log(1600000
报错的不在int n=(int)(log(k)/log(ex));,而在printf("%d %d\n",rand()%(n/5)+1,ex+1);!当n小于5时n/5=0,%(n/5)就是%0,被0除了,所以报错.