1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
| #include <iostream>
using namespace std;
void test() { cout << "函数" << endl; }
int 加(int num1, int num2) { return num1 + num2; }
int 减(int num1, int num2) { return num1 - num2; }
int 乘(int num1, int num2) { return num1 * num2; }
int 除(int num1, int num2) { return num1 / num2; }
int main() { test();
cout << "加" << 加(1,2) << endl; cout << "减" << 减(7, 2) << endl; cout << "乘" << 乘(3, 2) << endl; cout << "除" << 除(4, 2) << endl; return 0; }
|