Skip to content

Commit 75ebd87

Browse files
melhoramento na geração de notas
1 parent fb17608 commit 75ebd87

File tree

1 file changed

+24
-12
lines changed

1 file changed

+24
-12
lines changed

07_TheAlphaProject/ProjCLR/Form1.h

+24-12
Original file line numberDiff line numberDiff line change
@@ -400,8 +400,9 @@ namespace ProjCLR {
400400
this->button6->Name = L"button6";
401401
this->button6->Size = System::Drawing::Size(75, 23);
402402
this->button6->TabIndex = 5;
403-
this->button6->Text = L"button6";
403+
this->button6->Text = L"GerarNotas";
404404
this->button6->UseVisualStyleBackColor = true;
405+
this->button6->Click += gcnew System::EventHandler(this, &Form1::Button6_Click);
405406
//
406407
// button5
407408
//
@@ -910,20 +911,28 @@ namespace ProjCLR {
910911
// Gerar uma nota aleatória com ponderação (menos probabilidade de ocorrência nos extremos)
911912
private: int gerar_nota_especial()
912913
{
913-
int nota, extra;
914-
915-
nota = rnd->Next(8, 16); // gerar número aleatório para nota mediana
916-
917-
extra = rnd->Next(1, 20);
918-
switch (extra)
914+
int nota, pimPamPum;
915+
916+
pimPamPum = rnd->Next(1, 180);
917+
switch (pimPamPum)
919918
{
920-
case 0: // Nota muito baixa
921-
nota = rnd->Next(0, nota);
919+
case 1: // Negativa muito baixa
920+
nota = rnd->Next(1, 8);
921+
break;
922+
case 2: case 3: case 4: case 5: case 6: // Negativa alta
923+
nota = rnd->Next(8, 10);
924+
break;
925+
case 10: case 11: case 12: case 13: case 14: case 15: case 16: case 17: case 18: // Nota alta
926+
nota = rnd->Next(15, 18);
922927
break;
923-
case 1: // Nota muito alta
924-
nota = rnd->Next(nota, 21);
928+
case 20: case 21: case 22: // Nota muito alta
929+
nota = rnd->Next(18, 20);
930+
break;
931+
case 100: // Nota máxima
932+
nota = 20;
925933
break;
926934
default:
935+
nota = rnd->Next(10, 16); // gerar número aleatório para nota mediana
927936
break;
928937
}
929938
return nota;
@@ -1151,7 +1160,7 @@ private: void calcula_negas()
11511160
int negas_0_7;
11521161
int negas_8_9;
11531162
int nota;
1154-
String^ estado = "APROVADO";
1163+
String^ estado;
11551164

11561165
bool linha_intro = dataGridView1->AllowUserToAddRows;
11571166
dataGridView1->AllowUserToAddRows = false;
@@ -1172,6 +1181,8 @@ private: void calcula_negas()
11721181
estado = "REPROVADO";
11731182
else if ((negas_0_7 + negas_8_9) > 2)
11741183
estado = "REPROVADO";
1184+
else
1185+
estado = "APROVADO";
11751186

11761187
dataGridView1->Rows[i]->Cells[col_negas]->Value = (negas_0_7 + negas_8_9).ToString();
11771188
dataGridView1->Rows[i]->Cells[col_estado]->Value = estado;
@@ -1357,5 +1368,6 @@ private: System::Void GerarNotasToolStripMenuItem_Click(System::Object^ sender,
13571368
private: System::Void NotasToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) { stats_notas(); }
13581369
private: System::Void ToolStripComboBox1_Click(System::Object^ sender, System::EventArgs^ e) { recuperar_delegado(); }
13591370
private: System::Void GuardarDelegadoToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) { guardar_delegado();}
1371+
private: System::Void Button6_Click(System::Object^ sender, System::EventArgs^ e) { gerar_notas();}
13601372
};
13611373
}

0 commit comments

Comments
 (0)