Hello, I would be very grateful if you help me complete this program. The task is as follows:
Sports Federation of the office with information about the teams: team number. The name, played games, to win the match number, lose the match number, position.
Create a menu that lets you choose the action:
• displaying data on a computer screen
• Data Entry
• Data correction
• Data emissions
• List of sorting
• Search by location and occupied the team no.
• Program completion
Find loses a percentage of the number of matches played. Print a list sorted by the number of matches played.
I'm sorry, but English is little understood, so for any errors.
Here is my program code.
Unit1.h
------------
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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
//---------------------------------------------------------------------------
#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ExtCtrls.hpp>
#include <Grids.hpp>
#include <ComCtrls.hpp>
#include <ToolWin.hpp>
#include <string>
#include <fstream>
using namespace std;
//---------------------------------------------------------------------------
const char *komandos = "komandos.txt";
const int MAX = 20;
struct Komanda
{ char pavadinimas[15];
int nr,
zaista,
laimeta,
pralaimeta,
vieta;
};
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
TButton *Button1; // Mygtukas Skaityti
TButton *Button2; // Mygtukas Rikiuoti
TButton *Button3; // Mygtukas Paieska (neveikia)
TButton *Button4; // Mygtukas Procentas (neveikia)
TButton *Button5; // Mygtukas Baigti
TStringGrid *StringGrid1;
TGroupBox *GroupBox1; // Paieska
TLabel *Label1;
TEdit *Edit1; // Paieskos laukelis nr.1
TLabel *Label2;
TEdit *Edit2; // Paieskos laukelis nr.2
TMemo *Memo1; // Paieskos rezultatai
TButton *Button6; // Mygtukas Ieskoti
TGroupBox *GroupBox2; // Procentai
TMemo *Memo2; // Procentu skaiciavimo rezultatai
TButton *Button7; // Mygtukas Skaiciuoti
void __fastcall Button5Click(TObject *Sender);
void __fastcall Button1Click(TObject *Sender);
void __fastcall Button2Click(TObject *Sender);
void __fastcall Button3Click(TObject *Sender);
void __fastcall Button4Click(TObject *Sender);
private: // User declarations
int n;
Komanda A[MAX];
void Ivedimas();
void TForm1::Atvaizdavimas();
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
| |
Unit1.cpp
---------
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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
|
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
#include "String.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------- Duomenu skaitymas is failo -------------------------------------
void TForm1::Ivedimas()
{
n = 0;
ifstream fd(komandos);
while (!fd.eof() && n < MAX)
{
fd >> A[n].nr;
fd >> A[n].pavadinimas;
fd >> A[n].zaista;
fd >> A[n].laimeta;
fd >> A[n].pralaimeta;
fd >> A[n].vieta;
n++;
}
fd.close();
}
//---------------------------------------------------------------------------
void TForm1::Atvaizdavimas()
{ // antrasciu atspausdinimas StringGrid'e
StringGrid1->Cells[0][0] = " Nr.";
StringGrid1->Cells[1][0] = " Pavadinimas";
StringGrid1->Cells[2][0] = " Zaista";
StringGrid1->Cells[3][0] = " Laimeta";
StringGrid1->Cells[4][0] = " Pralaimeta";
StringGrid1->Cells[5][0] = " Vieta";
//---------------------------------------------------------------------------
StringGrid1->RowCount = n+1; // reikiamas eiluciu skaicius StringGrid'e
for(int i = 0; i < n; i++)
{
StringGrid1->Cells[0][i+1] = A[i].nr;
StringGrid1->Cells[1][i+1] = A[i].pavadinimas;
StringGrid1->Cells[2][i+1] = A[i].zaista;
StringGrid1->Cells[3][i+1] = A[i].laimeta;
StringGrid1->Cells[4][i+1] = A[i].pralaimeta;
StringGrid1->Cells[5][i+1] = A[i].vieta;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button5Click(TObject *Sender)
{
Close(); // Programos pabaiga
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
Ivedimas();
Atvaizdavimas();
GroupBox1->Visible = false;
GroupBox2->Visible = false;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
GroupBox1->Visible = false;
GroupBox2->Visible = false;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button3Click(TObject *Sender)
{
GroupBox1->Visible = true;
GroupBox2->Visible = false;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button4Click(TObject *Sender)
{
GroupBox2->Visible = true;
GroupBox1->Visible = false;
}
//---------------------------------------------------------------------------
| |
I want to see these two paragraphs code:
• List of sorting
• Search by location, and the team occupied No.