beginner array help

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

Can we see your attempt?
#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
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.