C++ 自定义函数以及调用函数

题目要求 自定义一个函数 通过调用函数返回一个值

方法

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <iostream>
using namespace std;

int res(int a, int b)
{
int c;
c = a ^ b * b;
return c;
}

int main()
{
cout << "Please input your number:" << endl << "one:";
int a;
cin >> a;
cout << endl << "and another?";
int b;
cin >> b;
cout << "OK.The result is:" << res(a, b) << endl << "Bye!";
}

本人技术有限代码并不精简且英语水平并不过关。仅供参考!