/********************************************************************************* Copyright (C), 1988-1999, drvivermonkey. Co., Ltd. File name: Author: Driver Monkey Version: Mail:[email protected] qq:196568501 Date: 2014.04.02 Description: 递归练习之 a 到 b 的整数和 *********************************************************************************/ #include <iostream> #include <sstream> #include <fstream> #include <iostream> #include <iomanip> #include <string> #include <memory.h> #include <thread> #include <stdlib.h> /* labs */ #include <math.h> using namespace std; static int fuction(int a, int b); int main() { cout<<"fuction = " <<fuction(1,4)<<endl; return 0; } static int fuction(int a, int b) { if(a > b) { return 0; } return (a + fuction(a + 1, b)); }
时间: 2024-10-12 08:35:04