@@ -400,8 +400,9 @@ namespace ProjCLR {
400
400
this ->button6 ->Name = L" button6" ;
401
401
this ->button6 ->Size = System::Drawing::Size (75 , 23 );
402
402
this ->button6 ->TabIndex = 5 ;
403
- this ->button6 ->Text = L" button6 " ;
403
+ this ->button6 ->Text = L" GerarNotas " ;
404
404
this ->button6 ->UseVisualStyleBackColor = true ;
405
+ this ->button6 ->Click += gcnew System::EventHandler (this , &Form1::Button6_Click);
405
406
//
406
407
// button5
407
408
//
@@ -910,20 +911,28 @@ namespace ProjCLR {
910
911
// Gerar uma nota aleatória com ponderação (menos probabilidade de ocorrência nos extremos)
911
912
private: int gerar_nota_especial ()
912
913
{
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)
919
918
{
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 );
922
927
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 ;
925
933
break ;
926
934
default :
935
+ nota = rnd->Next (10 , 16 ); // gerar número aleatório para nota mediana
927
936
break ;
928
937
}
929
938
return nota;
@@ -1151,7 +1160,7 @@ private: void calcula_negas()
1151
1160
int negas_0_7;
1152
1161
int negas_8_9;
1153
1162
int nota;
1154
- String^ estado = " APROVADO " ;
1163
+ String^ estado;
1155
1164
1156
1165
bool linha_intro = dataGridView1->AllowUserToAddRows ;
1157
1166
dataGridView1->AllowUserToAddRows = false ;
@@ -1172,6 +1181,8 @@ private: void calcula_negas()
1172
1181
estado = " REPROVADO" ;
1173
1182
else if ((negas_0_7 + negas_8_9) > 2 )
1174
1183
estado = " REPROVADO" ;
1184
+ else
1185
+ estado = " APROVADO" ;
1175
1186
1176
1187
dataGridView1->Rows [i]->Cells [col_negas]->Value = (negas_0_7 + negas_8_9).ToString ();
1177
1188
dataGridView1->Rows [i]->Cells [col_estado]->Value = estado;
@@ -1357,5 +1368,6 @@ private: System::Void GerarNotasToolStripMenuItem_Click(System::Object^ sender,
1357
1368
private: System::Void NotasToolStripMenuItem_Click (System::Object^ sender, System::EventArgs^ e) { stats_notas (); }
1358
1369
private: System::Void ToolStripComboBox1_Click (System::Object^ sender, System::EventArgs^ e) { recuperar_delegado (); }
1359
1370
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 ();}
1360
1372
};
1361
1373
}
0 commit comments