gpt4 book ai didi

c++ - 将整数值作为日期格式的字符串返回

转载 作者:太空宇宙 更新时间:2023-11-04 15:41:01 25 4
gpt4 key购买 nike

<分区>

我的函数具有三个整数值,分别代表年、月和日。我想用破折号“-”返回这些值,就像在常见的日期格式中一样。

例如:

int main() {
cout << myfunction() << endl; // this should display like this 2014-04-15
}

string myfunction() {
int year = 2014;
int month = 04;
int day = 15;
// I want to return this value like this
return year-month-day;//2014-04-15
}

有人可以帮助我吗?

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com