gpt4 book ai didi

C++ cout 不会打印

转载 作者:行者123 更新时间:2023-11-28 00:24:26 39 4
gpt4 key购买 nike

<分区>

正如标题所说,cout 不会打印任何东西!但是main正常执行完返回负数,这是怎么回事?这是我的代码:

#include <iostream>
using namespace std;
unsigned long fibonacci(long unsigned int *);
int main(void)
{
cout<<"IT WILL NOT PRINT!!!!!";
unsigned long int fib[4000000];
cout<<"SUM OF EVEN FIBONACCI NUMBERS: "<<fibonacci(fib)<<endl;
return 0;
}
unsigned long fibonacci(unsigned long int *FIBO)
{
unsigned long i;
int sum=0,c=0, *EVEN = new int[2000000];
FIBO[0]=1; FIBO[1]=2;
for (i=2;i<3999999;i++){
FIBO[i]=FIBO[i-1]+FIBO[i-2];
if (FIBO[i]%2==0){
EVEN[c]=FIBO[i];
sum+=EVEN[c];
c++;
}
}
delete [] EVEN;
return sum;
}

39 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com