you can also use printf("Case #%d: %04d\n",i++,value);

maybe you like to use the functions from C++, but printf is faster than
cout.. and, in this case, is a little bit easier to code.

2009/9/5 MagicLi <[email protected]>

>
> That is very good. Thanks a lot! I appreciate!
>
> On Sep 5, 4:14 am, krzych <[email protected]> wrote:
> > IO manipulators are your friends (include iomanip):
> >
> > cout << "Case #" << i+1 << ": " << setfill('0') << setw(4) << res <<
> > endl;
> >
> > On Sep 5, 8:24 am, MagicLi <[email protected]> wrote:
> >
> >
> >
> > > Like in qualification round for Problem C, we have to show 0000
> > > instead of 0, I did it in a ugly way, change int to string type and
> > > then add '0' if num<1000, add '00' if num<100, add '000' if num<10;
> > > can anyone have a better way? BTW, do not use C-style output like
> > > fprintf(ofp, "Case #%d: %04d\n", t, d[i-1][18]); because I prefer
> > > ofstream instead of C-style FILE*.
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"google-codejam" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to