cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
To what initilizer or data type, can I s
To what initilizer or data type, can I set it with value from ctime()?
Aug 26, 2014 at 10:23pm UTC
edwarlkd814
(8)
Hello, I am a beginner trying to familiarize with functions related to 'time'. I was looking to modify a time output below so that it will have only one line of output instead of hundreds of them thru loop.
1
2
3
4
5
6
7
while
(1) { time_t current = time(0); cout << ctime(¤t) << endl; }
what I figured was making another variable and set it to 'ctime(¤t)' but none of int, double, char, and few more in my knowledge would work.
and also, once I get the data for time (hr:min:sec), is there a way I can extract each data of hr,min,and sec from it?
Aug 26, 2014 at 10:35pm UTC
keskiverto
(10402)
http://www.cplusplus.com/reference/ctime/
explains function ctime. That seem to return a C-string. There are other functions too.
Topic archived. No new replies allowed.