Где ошибка
Код:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include <Grids.hpp>
#include "Unit1.h"
#include "Unit2.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
//---------------------------------------------------------------------------
int n;
int num[Nmax];
Student gruppa[Nmax], s1;
//---------------------------------------------------------------------------
void RazmernStrG(int n, TStringGrid *StrG, AnsiString st)
{ /*Процедура для задания размерности таблицы с данными о студентах
*/
StrG->ColCount = 9;
StrG->RowCount = n+1;
StrG->Cells[0][0] = st;
for(int i=0; i<=n; i++) {
StrG->Cells[0][i] = IntToStr(i);
StrG->Cells[1][0] = "ФИО";
StrG->Cells[2][0] = "ГР";
StrG->Cells[3][0] = "ГП";
StrG->Cells[4][0] = "Л_А";
StrG->Cells[5][0] = "М_А";
StrG->Cells[6][0] = "ИНФ";
StrG->Cells[7][0] = "ФИЗИКА";
StrG->Cells[8][0] = "Ф-РА";
}
}
//---------------------------------------------------------------------------
void inpzap(int n, Student a[], TStringGrid *StrG)
{ /*????????? ????? ???????? ??????? ?? ??????? StrG */
for(int i=0; i<n; i++) {
a[i].fio = StrG->Cells[1][i+1];
a[i].godr = StrToInt(StrG->Cells[2][i+1]);
a[i].godp = StrToInt(StrG->Cells[3][i+1]);
a[i].ocenk.lina = StrToInt(StrG->Cells[4][i+1]);
a[i].ocenk.analis = StrToInt(StrG->Cells[5][i+1]);
a[i].ocenk.inf = StrToInt(StrG->Cells[6][i+1]);
a[i].ocenk.fizika = StrToInt(StrG->Cells[7][i+1]);
a[i].ocenk.fiz_ra = StrToInt(StrG->Cells[8][i+1]);
}
}
//---------------------------------------------------------------------------
void outpz(int n, int k, double ss, Student a[],int num[], TStringGrid *Strg)
{
RazmernStrG(k, TStringGrid *Strg, "Студ.>средн.");
int j;
for(int i=0; i<k; i++) {
j=num[i];
StrG->Cells[1][i] = a[j].fio;
StrG->Cells[2][i] = IntToStr(a[j].godr);
StrG->Cells[3][i] = IntToStr(a[j].godp);
StrG->Cells[4][i] = IntToStr(a[j].ocenk.lina);
StrG->Cells[5][i] = IntToStr(a[j].ocenk.analis);
StrG->Cells[6][i] = IntToStr(a[j].ocenk.inf);
StrG->Cells[7][i] = IntToStr(a[j].ocenk.fizika);
StrG->Cells[8][i] = IntToStr(a[j].ocenk.fiz_ra);
}
}
//---------------------------------------------------------------------------
double midlocenk(int n, Student Gruppa[])
{
int count=0, sum=0;
for(int i=0; i<n; i++) {
sum = sum +gruppa[i].ocenk.lina +
gruppa[i].ocenk.analis+ gruppa[i].ocenk.inf +
gruppa[i].ocenk.fizika+ gruppa[i].ocenk.fiz_ra;
count = count+5;
}
return double(sum)/count;
}
//---------------------------------------------------------------------------
int kolstud(int n, Student gruppa[], double ss, int num[])
{
double r;
int j=0;
for(int i=0; i<n; i++) {
r = double(gruppa[i].ocenk.lina+
gruppa[i].ocenk.analis+ gruppa[i].ocenk.inf +
gruppa[i].ocenk.fizika+ gruppa[i].ocenk.fiz_ra)/5;
if(r>ss) {
num[j]=i;
j=j+1;
}
}
return j;
}
//---------------------------------------------------------------------------