|
-
May 5th, 2009, 04:06 PM
#17
Re: arrays
the code you have there won't even compile, once you fix this you might find that you've already done what you wanted. The setw hangs up the compiler, it's not a part of the iostream library in that form, though I don't know how to use it. I can help your recoding problem somewhat.
notice how this: void display_array (......); is different than these:
int display_array(.....);
float display_array(.....);
double display_array(.....);
char display_array(.....);
you treat void differently than the others inside the {} brackets. Typing void in front of the identifier means that it dose NOT return a value. This also means you do not need to place the "return;" statement at the end of your function. Otherwise you will need to return a char, int, float or double.
Secondly cout can be uses multiple times after it has been called. You've done this allready
here: cout << "\nOffset: " << setw(2) << i;
so telling it to type a little more by placeing the spaces between <<'s.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|