|
-
July 16th, 2010, 12:11 PM
#15
Re: Something about arrays
 Originally Posted by exdox77
how much clearer can I get!
I want to extract the element number from the array with out using a separate counter:
I have and array of 3 apples
apples[3] = {'green','red','yellow'};
I have a for loop
for(i = 0; i <= 2; i++)
cout << "Element number is: " << /* I need the element number not the contents of the element */
<< "Contents of Element: " << apples[i];
return 0;
I cant really get much clearer than that sir
So i is the element number. Just cout i wherever you want it. If i isn't the element number, you need to explain what you mean by that term.
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
|