masih bersama ane disini.. haha
ane bagi ilmu lagi nih yaitu cara membuat tanggal dan waktu di C++
Monggo sobs di coba langsung
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
| #include <iostream> #include <ctime> using namespace std; int main( ) { // current date/time based on current system time_t now = time( 0 ); cout << "Number of sec since January 1,1970:" << now << endl; tm *ltm = localtime(&now); // print various components of tm structure. cout << "Year: " << 1900 + ltm->tm_year << endl; cout << "Month: " << 1 + ltm->tm_mon<< endl; cout << "Day: " << ltm->tm_mday << endl; cout << "Time: " << 1 + ltm->tm_hour << ":" ; cout << 1 + ltm->tm_min << ":" ; cout << 1 + ltm->tm_sec << endl; } </ctime></iostream> |
1
2
| <iostream><ctime> </ctime></iostream> |
1
2
3
4
5
| Number of sec since January 1 , 1970 : 1294548238 Year: 2011 Month: 1 Day: 8 Time: 22 : 44 : 59 |
0 komentar:
Posting Komentar