有双重人格的题解
2025-07-15 20:46:48
发布于:江西
5阅读
0回复
0点赞
---------------------------------------------防-透-视-----------------------------------------------
---------------------------------------------防-透-视-----------------------------------------------
第一人格(一点都不叛逆):
直接加就完事了。
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b;
cin>>a>>b;
cout<<a+b;
return 0;
}
第二人格(乖孩纸):
既然题目说了要用函数,那就用函数呗~
int f(int a,int b){
return a+b;//函数的类型要和返回值对应
}
干就完了,整体如下↓
#include<bits/stdc++.h>
using namespace std;
int f(int a,int b){
return a+b;
}
int main(){
int a,b;
cin>>a>>b;
cout<<f(a,b);
return 0;
}
因为我AC了呀!ヾ(๑╹◡╹)ノ"
给个赞吧,求求啦。
这里空空如也
有帮助,赞一个