//Братишка, я тебе С++ принёс
#include <iostream>
/*
#include<cstdlib>
#include<ctime>
#include<cmath>*/
using namespace std;
/*
void fill(int arr[32]){
srand(time(NULL));
for(int i = 0;i<32;i++){
arr[i] = rand()%22 + 147;
}
}*/
int main()
{
int students[32];
//fill(students);
for(int i = 0;i<32;i++){
cin>>students[i];
}
int max_index = students[0];
for(int i = 0;i<32;i++){
if(students[i]>max_index){
max_index=i;
}
//Не обязательно
else{
continue;
}
}
cout<<"Рост:"<<students[max_index]<<endl;
cout<<"Номер:"<<max_index+1;
return 0;
}
Объяснение:
Код в комментариях нужен для автоматизации заполнения(чтобы не придумывать 32 числа)
// Програма1:
#include <iostream>
using namespace std;
const int n = 15;
int main() {
int i, count;
float B, A[n];
cout << "B=";
cin >> B;
for(i = 0; i < n; i++){
cout << "A[" << i << "]="; cin >> A[i];
}
count = 0;
for(i = 0; i < n; i++)
if (A[i] > B)
count++;
cout << count << endl;
return 0;
}
// Програма2:
#include <iostream>
using namespace std;
const int n = 15;
int main() {
int i, count;
float B, A[n] = {3.05,-9,-5,22.5,12,-6.045,5,9,3,-5,4.1,8,1,0,15};
cout << "B=";
cin >> B;
count = 0;
for(i = 0; i < n; i++)
if (*(A + i) > B)
count++;
cout << count << endl;
return 0;
}