@jonson
234 / 207 / 61
Регистрация: 18.03.2010
Сообщений: 750
|
19.05.2011, 20:40
|
|
C++ | 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
| # include<iostream.h>
# define N 15
using namespace std;
void main(void)
{
int a[N], i=0;
int num,num2,pos,pos2;
num=num2=pos=pos2=0;
do {
cin >> a[i];
if(a[i] > num)
{
num2 = num;
pos2 = pos;
num = a[i];
pos = i;
}
if(a[i] > num2 && a[i] < num)
{
num2 = a[i];
pos2 = i;
}
i++;
} while (i<N);
cout << "\n\n\n";
for(int x=0; x<i; x++)
cout << a[x] << " ";
cout << "\n\n\n" << "The greatest numbers:\n\t" << num << " position [" << pos+1 <<"]";
cout << "\n\t" << num2 << " position [" << pos2+1 << "]" << endl << endl; |
|
1
|