Computer Science Canada Loop Help Needed |
Author: | JWHooper [ Mon Feb 18, 2008 9:58 pm ] | ||||||
Post subject: | Loop Help Needed | ||||||
Write a program that displays the following table (note that 1 mile is 1.609 kilometers):
. . . I tried my own code for this:
But, the result was:
Can anyone revise and edit my code in terms of basic C++ language terms (not advanced or anything)? If anyone can, I would be appreciated. Thanks, J. |
Author: | Nick [ Mon Feb 18, 2008 10:05 pm ] | ||
Post subject: | RE:Loop Help Needed | ||
I haven't tried it but it should work
|
Author: | JWHooper [ Mon Feb 18, 2008 10:18 pm ] | ||
Post subject: | Re: RE:Loop Help Needed | ||
momop @ Mon Feb 18, 2008 7:05 pm wrote: I haven't tried it but it should work
Okay. I'll try this on my compiler a little later. |
Author: | Nick [ Mon Feb 18, 2008 10:24 pm ] |
Post subject: | RE:Loop Help Needed |
![]() this what you wanted? |
Author: | wtd [ Tue Feb 19, 2008 11:17 am ] |
Post subject: | RE:Loop Help Needed |
You should set the width for the first "column" to 2 to get proepr alignment. |
Author: | JWHooper [ Tue Feb 19, 2008 9:37 pm ] |
Post subject: | Re: RE:Loop Help Needed |
momop @ Mon Feb 18, 2008 7:24 pm wrote: ![]() this what you wanted? Almost, but I wanted to make the 10 miles column look perfect, too. |
Author: | md [ Tue Feb 19, 2008 9:50 pm ] |
Post subject: | RE:Loop Help Needed |
setw aligns to the left, use it on the first column instead of teh second. Problem solved! |