課程
/后端開發(fā)
/C
/C語(yǔ)言入門
輸入時(shí)間算出,這個(gè)時(shí)間是在這天的第幾秒 ? ?程序?qū)懞?jiǎn)單 ?謝謝
2015-04-15
源自:C語(yǔ)言入門 1-5
正在回答
#include <iostream>
#include <string>
using ?namespace std;
int main()
{
string Time;//格式為23:00:00
cin>>Time;
int hour;
? ? int mins;
int secs;
hour = atoi(Time.substr(0,2).c_str());
mins = atoi(Time.substr(4,5).c_str());
secs = atoi(Time.substr(7,8).c_str());
cout<<hour*3600 + mins * 60 + secs ;
system("pause");
return 0;
}
舉報(bào)
C語(yǔ)言入門視頻教程,帶你進(jìn)入編程世界的必修課-C語(yǔ)言
2 回答這接怎么編寫啊
1 回答這個(gè)怎么寫啊
1 回答這個(gè)程序怎么寫啊
1 回答這個(gè)編碼是怎么寫的?
1 回答這題怎么寫啊
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號(hào)-11 京公網(wǎng)安備11010802030151號(hào)
購(gòu)課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動(dòng)學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號(hào)
2015-04-15
#include <iostream>
#include <string>
using ?namespace std;
int main()
{
string Time;//格式為23:00:00
cin>>Time;
int hour;
? ? int mins;
int secs;
hour = atoi(Time.substr(0,2).c_str());
mins = atoi(Time.substr(4,5).c_str());
secs = atoi(Time.substr(7,8).c_str());
cout<<hour*3600 + mins * 60 + secs ;
system("pause");
return 0;
}