-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rezultat_Test.cpp
executable file
·140 lines (122 loc) · 3.09 KB
/
Rezultat_Test.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
//---------------------------------------------------------------------------
#include <fmx.h>
#include <string.h>
#include <fstream>
#include <stdlib.h>
#include <cstring>
#include <direct.h>
#pragma hdrstop
#include "Testare_Cunostinte.h"
#include "Mod_Elev.h"
#include "Mod_Profesor.h"
#include "Meniu.h"
#include "Rezultat_Test.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.fmx"
TRezultatTest *RezultatTest;
char rezultat[300],rcorect[500];
int OK=0,pg_cur=1,pg_tot=1,pg_cor=1;
//---------------------------------------------------------------------------
__fastcall TRezultatTest::TRezultatTest(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TRezultatTest::FormActivate(TObject *Sender)
{
if (OK==0)
{
Back->Opacity=0;
int i;
char temp[500];
ofstream g("temp.res");
g<<"Ai obtinut nota: ";
g<<float(TestareCunostinte->nota);
g.close();
ifstream f("temp.res");
f.get(rezultat,100);
f.close();
Rezultat->Text=rezultat;
strcpy(temp,ModElev->locatie);
strcat(temp,"Test/Pagini.res");
ifstream ff(temp);
ff>>pg_tot;
ff.close();
for (i=1;i<=pg_tot;i++)
{
if (TestareCunostinte->corect[i]==0)
break;
}
pg_cur=i;
Intrebare->Text=TestareCunostinte->intrebare[pg_cur].intrebare;
afisare(pg_cur);
remove("temp.res");
OK=1;
}
}
//---------------------------------------------------------------------------
void __fastcall TRezultatTest::NextClick(TObject *Sender)
{
int i;
//pg_tot--;
for (i=pg_cur+1;i<=pg_tot;i++)
{
if (TestareCunostinte->corect[i]==0)
break;
}
if (i<=pg_tot)
{
pg_cor++;
if (pg_cor==1) Back->Opacity=0;
else Back->AnimateFloat("Opacity",1);
pg_cur=i;
Intrebare->Text=TestareCunostinte->intrebare[pg_cur].intrebare;
afisare(pg_cur);
//remove("temp.res");
}
else
{
RezultatTest->Close();
OK=0;
ModElev->Show();
}
}
//---------------------------------------------------------------------------
void __fastcall TRezultatTest::BackClick(TObject *Sender)
{
int i;
for (i=pg_cur-1;i>=1;i--)
{
if (TestareCunostinte->corect[i]==0)
break;
}
pg_cor--;
if (pg_cor==1) Back->AnimateFloat("Opacity",0);
pg_cur=i;
Intrebare->Text=TestareCunostinte->intrebare[pg_cur].intrebare;
afisare(pg_cur);
remove("temp.res");
//conditite de iesire
}
//---------------------------------------------------------------------------
void __fastcall TRezultatTest::NextMouseEnter(TObject *Sender)
{
Next->AnimateFloat("Opacity",0.3);
}
//---------------------------------------------------------------------------
void __fastcall TRezultatTest::NextMouseLeave(TObject *Sender)
{
Next->AnimateFloat("Opacity",1);
}
//---------------------------------------------------------------------------
void __fastcall TRezultatTest::BackMouseEnter(TObject *Sender)
{
Back->AnimateFloat("Opacity",0.3);
}
//---------------------------------------------------------------------------
void __fastcall TRezultatTest::BackMouseLeave(TObject *Sender)
{
Back->AnimateFloat("Opacity",1);
}
//---------------------------------------------------------------------------