I know how to get it, basically. It's just for my program, it's 362 minutes. That is 6:02. The thing is it's ZERO two. I don't know how to get the zero and then the two?
geekykitty
0
Newbie Poster
Recommended Answers
Jump to PostUse the stream manipulators std::setw and std::setfill.
http://www.cplusplus.com/reference/iostream/manipulators/setfill/#include <iostream> #include <iomanip> int main() { int hours = 6 ; int minutes = 2 ; std::cout << hours << ':' << std::setw(2) << std::setfill('0') << minutes << '\n' ; }
All 3 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.