1 Star 0 Fork 1

dhs347/cppstudy

forked from Huoty/cppstudy 
加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
test_ref.cpp 842 Bytes
一键复制 编辑 原始数据 按行查看 历史
Huoty 提交于 2024-12-08 23:34 +08:00 . update at 20241208233432
/*
* Copyright (c) JoinQuant Development Team
* Author: Huayong Kuang <kuanghuayong@joinquant.com>
*
*/
#include <iostream>
using namespace std;
void convert(int &a, int &b, bool a2b=true);
void addThree(int& num1, int& num2, int& num3, int& sum)
{
sum = num1 + num2 + num3;
}
void convert(int &a, int &b, bool a2b) {
if (a2b) {
b = 1000;
} else {
a = 2000;
}
}
void transfer_str(string &s1, const string &s2=string("111")) {
s1 = s2;
}
int main(void)
{
int n1 = 1, n2 = 2, n3 = 3, s;
addThree(n1, n2, n3, s);
cout << s << endl;
int a;
int b;
int m = 10;
convert(m, b);
cout << b << endl;
convert(a, m, false);
cout << a << endl;
string ss;
transfer_str(ss);
//transfer_str(ss, string("hello world"));
cout << ss << endl;
return 0;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/dhs347/cppstudy.git
git@gitee.com:dhs347/cppstudy.git
dhs347
cppstudy
cppstudy
master

搜索帮助