if i hav to input time of clock as formatted style(HH:MM:SEC) using cin how can i write its code???? a question from @robert lafore(sams publication) .

hope to get a best answer soon :)

Recommended Answers

All 2 Replies

ye' could chain the cin operation together like this:

cout << "Enter clock time: (HH MM SS) ";
cin >> hour >> min >> sec;

of course this method is highly dependant on the user making proper input seperated with white spaces.

sr as we press enter after first input i.e hrs ,cursor will move to nxt line...and the format will no more look like that??? is there any possibilities to input in such format in c++ (input through array is avoided).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.