Re: second largest element in an array



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;
}

.



Relevant Pages

  • Re: std::vectors reserve(), erase() and clear()
    ... Alex Vinokur wrote: ... > using namespace std; ... > int main ... Prev by Date: ...
    (microsoft.public.vc.language)
  • If .....
    ... using namespace std; ... int main ... Why does this fragment of code generate the following error! ... Prev by Date: ...
    (microsoft.public.vc.language)
  • wcscoll bug?
    ... The following program outputs -1 in both VC6 and VC.NET. ... using namespace std; ... int main ... Prev by Date: ...
    (microsoft.public.vc.language)
  • Re: How can I get the input from keyboard without using swing?
    ... > using namespace std; ... > int main ... * Returns a single line read from the keyboard. ... Prev by Date: ...
    (comp.lang.java.programmer)
  • Re: Linux 2.6.32.19
    ... +static inline int s390_nohz_delay ... unsigned long prev; ... struct irq_desc *desc; ... return ret; ...
    (Linux-Kernel)