Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8892161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:55:28+00:00 2026-06-14T22:55:28+00:00

I have a program that displays songs read in from a text file along

  • 0

I have a program that displays songs read in from a text file along with the time and displays them in a neat organized manner in the console. I’m having trouble however having an integer display 01 or 06 as opposed to 1 or 6 for my time format (00:00:00). How would i go about manipulating the output to display a zero infront of the integer when it is below 10?

An example output from my program:

SONG TITLE
The once and future carpenter      0:4:52
I never knew you                   0:7:48
Life                               0:10:52
February seven                     0:15:0
My lfe                             0:24:12
Yuor frei                          0:37:20
Lisjlf                             0:49:23
Lasifj                             0:53:39
Longsong                           1:9:2
Longer                             1:22:3
Almost done                        1:34:48

Process returned 0 (0x0)   execution time : 0.280 s
Press any key to continue.

Desired Output:

SONG TITLE
The once and future carpenter      00:04:52
I never knew you                   00:07:48
Life                               00:10:52
February seven                     00:15:00
My lfe                             00:24:12
Yuor frei                          00:37:20
Lisjlf                             00:49:23
Lasifj                             00:53:39
Longsong                           01:09:02
Longer                             01:22:03
Almost done                        01:34:48

Process returned 0 (0x0)   execution time : 0.280 s
Press any key to continue.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T22:55:29+00:00Added an answer on June 14, 2026 at 10:55 pm

    And how do you display your values? Using stream utilities provided by standard library? if so, you could use setw manipulator in conjunction with setfill. stdio counterparts also allow specifying of widht and fill, using appropriate flags with format specifier:

    #include <iomanip>
    #include <iostream>
    
    ...
    cout << setw(2) << setfill('0') << h << ':' 
        << setw(2) << setfill('0') << m << ':' 
        << setw(2) << setfill('0') << s << '\n'; 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have installed RHQ monitoring system http://rhq-project.org/display/RHQ/Home . From that time our program started
I have a program that displays information(simple text, but not in a txt box,
I have a simple Java program that reads in a text file, splits it
I have implemented a simple GPS program that fetches the co-ordinates and displays them
I have a clock feature in a VB.NET program that displays the time including
I have a vb program that reads data from an excel sheet and displays
I have a program that displays and inventory report and i was just wondering
I have a C# program that displays a list of patients with medications where
I have a chat program that displays I list of online users. The message
I have a program that receives webcam video and displays it on a C#

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.