02_3.cpp
来自「一些C++的课件和实验源代码」· C++ 代码 · 共 40 行
CPP
40 行
// 02_3.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "stdio.h"
#include "conio.h"
int a[10000000];
int f(int n)
{
int ret = 0;
if( n > 0){
ret = n + f(n - 1);
}
return ret;
}
int main(int argc, char* argv[])
{
// int a[10000000];
// int * pa = new int[10000000];
// if( pa != NULL ){
// printf("\n address of pa = %d", pa);
// delete []pa;
// pa = NULL;
// }
int n = 1000;
int ret = f(n);
printf("\n f(%d) = %d", n, ret);
getch();
return 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?