diff --git a/递归求和.cpp b/递归求和.cpp deleted file mode 100644 index f73acf8..0000000 --- a/递归求和.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include -using namespace std; - -int SumArray(int a[], int n, int x) { - if (n == 0) { - return 0; - } else { - return a[x - n] + SumArray(a, n - 1, x); - } -} - -int main() { - int a[50], n; - cout << "ÇëÊäÈëÊý×éÖÐÊýµÄ¸öÊý£º"; - cin >> n; - cout << "ÇëÏòÊý×éÊäÈ룺"; - - for (int i = 0; i < n; i++) { - - cin >> a[i]; - } - - cout << "Êý×éµÄºÍΪ£º" ; - cout << SumArray(a, n, n); - return 0; -} \ No newline at end of file