課程
/后端開發(fā)
/C
/C語言入門
輸入時間算出,這個時間是在這天的第幾秒 ? ?程序?qū)懞唵??謝謝
2015-04-15
源自:C語言入門 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;
}
舉報
C語言入門視頻教程,帶你進入編程世界的必修課-C語言
2 回答這接怎么編寫啊
1 回答這個怎么寫啊
1 回答這個程序怎么寫啊
1 回答這個編碼是怎么寫的?
1 回答這題怎么寫啊
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網(wǎng)安備11010802030151號
購課補貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號
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;
}