Re: second largest element in an array
- From: "Lemor" <lemor2006@xxxxxxxxx>
- Date: 28 Jan 2006 21:14:55 -0800
here's your porgram:
I compile my prorams in VC++. it'll surely work!
#include<iostream>
using namespace std;
int main()
{
int aray[100],n,temp=0,m;
cin>>n;
for(int j=0;j<n;j++)
{
cin>>aray[j];
}
for(j=0;j<n;j++)
{
if(aray[j] >= temp)
{
temp=aray[j];
m=j;
}
}
aray[m]=0;temp=0;
for(j=0;j<n;j++)
{
if(aray[j] >= temp)
{
temp=aray[j];
}
}
cout<<endl<<temp;
return 0;
}
.
- Follow-Ups:
- Re: second largest element in an array
- From: Martin Ambuhl
- Re: second largest element in an array
- References:
- second largest element in an array
- From: Rajesh
- second largest element in an array
- Prev by Date: Re: how do increment operations work
- Next by Date: Re: second largest element in an array
- Previous by thread: Re: second largest element in an array
- Next by thread: Re: second largest element in an array
- Index(es):
Relevant Pages
|