大众信息网

求解一道简单关于输出日期的C++小题

关注:203  答案:2  手机版
解决时间 2021-01-27 22:16
/.find("/?为什么是到u哪里;).rfind("<); } 我知道答案是, i-k-4).substr(0:&quot.close()?.substr(k+1; /myTextl;Date < cout?;endl; substr() 函数返回字符串的一部分k+1是J的位置?.find(" cout &lt.rfind("fstream> void main() { ofstream cout,i-k-4是;/< + Year; /.substr(k+1;<Converted date, ";2008; int i = Date,1的前面)那个位置(i=) string Month =Date;); string NewDate = Day + "i 到“ ”(空格, 2), January 1" + Month + " cout &lt: 2008;/, January 1"新改 string Day = Date;< " < cout; int k =Date#include &lt,”那个位置(k=5) int i =Date;; #include <k到“;);新改 string Month = Date;" string Date(");/ /.substr(0, i-k-4); &quot, 4), 4);); string Year =Date: string Date(&quot:&quot, January 1 1 Janu 2008 解题思路; "iostream> #include <"&lt!我左减减右减减也减不出来;</ string Year = Date; <original date; int k = Date; " using namespace std.substr(i+1;/), "2008.txt&quot.open("string>NewDate <endl
最佳答案
substr() 参数应该是(起始位置,长度)这样的吧,应该该i-k-1
全部回答
k = 4i = 12, i-k-1).substr(k+1;你要得到月 应该是这样string Month =Date
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!