/* C++ compiler gcc (Ubuntu 5.2.1-22ubuntu2) 5.2.1 20151010 Copyright (C) 2015 Free Software Foundation, Inc. */
#include <iostream> #include <vector> using namespace std;
int main() { int count = 0; cout <<"Введите количество призывников: "; cin >>count; if (count>17) count=17; vector<int> tanks(count); for (unsigned i=0; i<tanks.size(); i++) cin >>tanks[i]; int min=300, max=0; for (unsigned i=0; i<tanks.size(); i++) { if (min>tanks[i]) min=tanks[i]; if (max<tanks[i]) max=tanks[i]; } int cnt=0; for (unsigned i=0; i<tanks.size(); i++) { if ((tanks[i]!=min) and (tanks[i]!=max)) cnt++; }
program max_elementarray ;
var i, max : integer ;
a : array [1..10] of integer;
begin
for i : = 1 to 10 do
begin
readln(a[i]);
end;
max : = a[1];
for i : = 2 to 10 do
if a[i]> max then max : = a[i];
writeln('max element of array = ',max) ;
readln ;
end.
C++ compiler
gcc (Ubuntu 5.2.1-22ubuntu2) 5.2.1 20151010
Copyright (C) 2015 Free Software Foundation, Inc.
*/
#include <iostream>
#include <vector>
using namespace std;
int main()
{
int count = 0;
cout <<"Введите количество призывников: ";
cin >>count;
if (count>17) count=17;
vector<int> tanks(count);
for (unsigned i=0; i<tanks.size(); i++) cin >>tanks[i];
int min=300, max=0;
for (unsigned i=0; i<tanks.size(); i++)
{
if (min>tanks[i]) min=tanks[i];
if (max<tanks[i]) max=tanks[i];
}
int cnt=0;
for (unsigned i=0; i<tanks.size(); i++)
{
if ((tanks[i]!=min) and (tanks[i]!=max)) cnt++;
}
cout <<cnt <<endl;
}