beginner array help

Oct 29, 2013 at 6:05pm
create a program that will ask the user to input 10 integers of an array the program must write the index of the greatest element of the array

target output

input the integers

the greatest element is 5 and the index is 7

Oct 29, 2013 at 6:34pm
Can we see your attempt?
Oct 29, 2013 at 7:15pm
#include<iostream>
using namespace std;
int main()
{

int array[10]

for( int i = 0; i<= 10+ i++ )
{
cout<<"Enter ten integers"<<i<<" : ";
cin>>array[i];


return 0;

}

dont know how to call the index and so it reveals what it is please help thanks
Oct 29, 2013 at 7:39pm
The same way you're writing into the integer array at each step of your loop, at this line:
cin>>array[i];

array[index] can be used for getting a value stored at a certain index just as it can be for writing to a certain element of an array. Use it like you might a normal variable.

-Albatross

Topic archived. No new replies allowed.