Solução do Exercício Cadastro Alunos: mudanças entre as edições

De IFSC
Ir para navegação Ir para pesquisar
imported>Fargoud
Sem resumo de edição
imported>Fargoud
Sem resumo de edição
Linha 51: Linha 51:
   {
   {
   }
   }
Código Form1.h
#include "CadastraNomes.h"
#include "Aluno.h" 
using namespace std;
#pragma once
namespace RegistroAcademico {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
/// <summary>
/// Summary for Form1
///
/// WARNING: If you change the name of this class, you will need to change the
///          'Resource File Name' property for the managed resource compiler tool
///          associated with all .resx files this class depends on.  Otherwise,
///          the designers will not be able to interact properly with localized
///          resources associated with this form.
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{  '''Aluno paluno;''' //**declaração do objeto aqui - global ao Form!!!!
public:
Form1(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}
protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Button^  button1;
private: System::Windows::Forms::Label^  label1;
private: System::Windows::Forms::Label^  label2;
private: System::Windows::Forms::Label^  label3;
private: System::Windows::Forms::Label^  label4;
private: System::Windows::Forms::Label^  label5;
private: System::Windows::Forms::ListBox^  listBox1;
private: System::Windows::Forms::TextBox^  textBox1;
private: System::Windows::Forms::MaskedTextBox^  maskedTextBox1;
private: System::Windows::Forms::Button^  button2;
private: System::Windows::Forms::Label^  label6;
private: System::Windows::Forms::Label^  label7;
private: System::Windows::Forms::Button^  button3;
private: System::Windows::Forms::Panel^  panel1;
private: System::Windows::Forms::TextBox^  textBox2;
private: System::Windows::Forms::ListBox^  listBox2;
private: System::Windows::Forms::MaskedTextBox^  maskedTextBox2;
protected:
private:
/// <summary>
/// Required designer variable.
/// </summary>
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
void InitializeComponent(void)
{
this->button1 = (gcnew System::Windows::Forms::Button());
this->label1 = (gcnew System::Windows::Forms::Label());
this->label2 = (gcnew System::Windows::Forms::Label());
this->label3 = (gcnew System::Windows::Forms::Label());
this->label4 = (gcnew System::Windows::Forms::Label());
this->label5 = (gcnew System::Windows::Forms::Label());
this->listBox1 = (gcnew System::Windows::Forms::ListBox());
this->textBox1 = (gcnew System::Windows::Forms::TextBox());
this->maskedTextBox1 = (gcnew System::Windows::Forms::MaskedTextBox());
this->button2 = (gcnew System::Windows::Forms::Button());
this->label6 = (gcnew System::Windows::Forms::Label());
this->label7 = (gcnew System::Windows::Forms::Label());
this->button3 = (gcnew System::Windows::Forms::Button());
this->panel1 = (gcnew System::Windows::Forms::Panel());
this->textBox2 = (gcnew System::Windows::Forms::TextBox());
this->listBox2 = (gcnew System::Windows::Forms::ListBox());
this->maskedTextBox2 = (gcnew System::Windows::Forms::MaskedTextBox());
this->panel1->SuspendLayout();
this->SuspendLayout();
//
// button1
//
this->button1->Location = System::Drawing::Point(515, 190);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(120, 63);
this->button1->TabIndex = 5;
this->button1->Text = L"Entra Notas";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
//
// label1
//
this->label1->AutoSize = true;
this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(0)));
this->label1->Location = System::Drawing::Point(37, 43);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(55, 20);
this->label1->TabIndex = 1;
this->label1->Text = L"Nome:";
//
// label2
//
this->label2->AutoSize = true;
this->label2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(0)));
this->label2->Location = System::Drawing::Point(37, 81);
this->label2->Name = L"label2";
this->label2->Size = System::Drawing::Size(159, 20);
this->label2->TabIndex = 2;
this->label2->Text = L"Número de Matrícula:";
//
// label3
//
this->label3->AutoSize = true;
this->label3->Enabled = false;
this->label3->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(0)));
this->label3->Location = System::Drawing::Point(12, 67);
this->label3->Name = L"label3";
this->label3->Size = System::Drawing::Size(76, 20);
this->label3->TabIndex = 3;
this->label3->Text = L"Situação:";
//
// label4
//
this->label4->AutoSize = true;
this->label4->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(0)));
this->label4->Location = System::Drawing::Point(37, 123);
this->label4->Name = L"label4";
this->label4->Size = System::Drawing::Size(148, 20);
this->label4->TabIndex = 4;
this->label4->Text = L"Lista de Disciplinas:";
//
// label5
//
this->label5->AutoSize = true;
this->label5->Enabled = false;
this->label5->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(0)));
this->label5->Location = System::Drawing::Point(3, 15);
this->label5->Name = L"label5";
this->label5->Size = System::Drawing::Size(146, 20);
this->label5->TabIndex = 5;
this->label5->Text = L"Média na disciplina:";
//
// listBox1
//
this->listBox1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(0)));
this->listBox1->FormattingEnabled = true;
this->listBox1->ItemHeight = 20;
this->listBox1->Location = System::Drawing::Point(41, 183);
this->listBox1->Name = L"listBox1";
this->listBox1->Size = System::Drawing::Size(162, 224);
this->listBox1->TabIndex = 4;
//
// textBox1
//
this->textBox1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(0)));
this->textBox1->Location = System::Drawing::Point(98, 37);
this->textBox1->Name = L"textBox1";
this->textBox1->Size = System::Drawing::Size(222, 29);
this->textBox1->TabIndex = 0;
//
// maskedTextBox1
//
this->maskedTextBox1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(0)));
this->maskedTextBox1->Location = System::Drawing::Point(211, 78);
this->maskedTextBox1->Mask = L"000000";
this->maskedTextBox1->Name = L"maskedTextBox1";
this->maskedTextBox1->Size = System::Drawing::Size(74, 29);
this->maskedTextBox1->TabIndex = 1;
//
// button2
//
this->button2->Location = System::Drawing::Point(253, 152);
this->button2->Name = L"button2";
this->button2->Size = System::Drawing::Size(118, 54);
this->button2->TabIndex = 3;
this->button2->Text = L"Nova disciplina";
this->button2->UseVisualStyleBackColor = true;
this->button2->Click += gcnew System::EventHandler(this, &Form1::button2_Click);
//
// label6
//
this->label6->AutoSize = true;
this->label6->Enabled = false;
this->label6->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(0)));
this->label6->ForeColor = System::Drawing::SystemColors::Desktop;
this->label6->Location = System::Drawing::Point(155, 15);
this->label6->Name = L"label6";
this->label6->Size = System::Drawing::Size(20, 24);
this->label6->TabIndex = 10;
this->label6->Text = L"0";
//
// label7
//
this->label7->AutoSize = true;
this->label7->Enabled = false;
this->label7->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(0)));
this->label7->ForeColor = System::Drawing::SystemColors::Desktop;
this->label7->Location = System::Drawing::Point(110, 67);
this->label7->Name = L"label7";
this->label7->Size = System::Drawing::Size(25, 24);
this->label7->TabIndex = 11;
this->label7->Text = L"...";
//
// button3
//
this->button3->Location = System::Drawing::Point(253, 409);
this->button3->Name = L"button3";
this->button3->Size = System::Drawing::Size(113, 96);
this->button3->TabIndex = 6;
this->button3->Text = L"CADASTRA ALUNO";
this->button3->UseVisualStyleBackColor = true;
this->button3->Click += gcnew System::EventHandler(this, &Form1::button3_Click);
//
// panel1
//
this->panel1->Controls->Add(this->label5);
this->panel1->Controls->Add(this->label6);
this->panel1->Controls->Add(this->label7);
this->panel1->Controls->Add(this->label3);
this->panel1->Location = System::Drawing::Point(26, 531);
this->panel1->Name = L"panel1";
this->panel1->Size = System::Drawing::Size(355, 107);
this->panel1->TabIndex = 12;
//
// textBox2
//
this->textBox2->Location = System::Drawing::Point(42, 151);
this->textBox2->Name = L"textBox2";
this->textBox2->Size = System::Drawing::Size(160, 20);
this->textBox2->TabIndex = 2;
//
// listBox2
//
this->listBox2->FormattingEnabled = true;
this->listBox2->Location = System::Drawing::Point(396, 230);
this->listBox2->Name = L"listBox2";
this->listBox2->Size = System::Drawing::Size(103, 160);
this->listBox2->TabIndex = 13;
//
// maskedTextBox2
//
this->maskedTextBox2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(0)));
this->maskedTextBox2->Location = System::Drawing::Point(396, 190);
this->maskedTextBox2->Mask = L"90";
this->maskedTextBox2->Name = L"maskedTextBox2";
this->maskedTextBox2->Size = System::Drawing::Size(40, 29);
this->maskedTextBox2->TabIndex = 14;
this->maskedTextBox2->Text = L"00";
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(647, 650);
this->Controls->Add(this->maskedTextBox2);
this->Controls->Add(this->listBox2);
this->Controls->Add(this->textBox2);
this->Controls->Add(this->panel1);
this->Controls->Add(this->button3);
this->Controls->Add(this->button2);
this->Controls->Add(this->maskedTextBox1);
this->Controls->Add(this->textBox1);
this->Controls->Add(this->listBox1);
this->Controls->Add(this->label4);
this->Controls->Add(this->label2);
this->Controls->Add(this->label1);
this->Controls->Add(this->button1);
this->Name = L"Form1";
this->Text = L"Cadastro de Alunos";
this->panel1->ResumeLayout(false);
this->panel1->PerformLayout();
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
static float soma=0;
int n;
// if(listBox1->SelectedIndex == 0)
// {  CadastraNomes^ Form2 = gcnew CadastraNomes;
        //  Form2->Visible = true;
            if(listBox2->Items->Count < 5)
{ label3->Enabled = true;
              label5->Enabled = true;
              label6->Enabled = true;
  label7->Enabled = true;
  listBox2->Items->Add(maskedTextBox2->Text);
  soma += Convert::ToDouble(maskedTextBox2->Text);
  n = Convert::ToInt16(listBox2->Items->Count);
  listBox2->Select();
  maskedTextBox2->Clear();
  maskedTextBox2->Focus(); }
else
{ MessageBox::Show("Limite máximo de notas por disciplina: 5",
"Número Máximo de Notas",
MessageBoxButtons::OK, MessageBoxIcon::Error);
    maskedTextBox2->Clear();
}
            paluno.Medias = soma/n;
label6->Text = Convert::ToString(paluno.Medias);
}
private: System::Void button2_Click(System::Object^  sender, System::EventArgs^  e) {
if(listBox1->Items->Count < 10)
{ listBox1->Items->Add(textBox2->Text);
  listBox1->Select();
  textBox2->Clear();
  textBox2->Focus(); }
else
{ MessageBox::Show("Limite máximo de disciplinas por semestre: 10",
"Número Máximo de Disciplinas",
MessageBoxButtons::OK, MessageBoxIcon::Error);
    textBox2->Clear();
}
  listBox1->SelectedIndex = 0;
}
private: System::Void button3_Click(System::Object^  sender, System::EventArgs^  e) {
int i;
paluno.NomeAluno = textBox1->Text;
paluno.NumMatricula = maskedTextBox1->Text;
paluno.ListaDisciplinas = listBox1->Items->ToString();
paluno.ndisc = listBox1->Items->Count;
if(paluno.Medias >=6)
{ paluno.aprovado = true;
    label7->Text = "Apto";
}
else
{ paluno.aprovado = false;
    label7->Text = "Não Apto";
}
//paluno->NomeAluno = textBox1->Text;
//paluno->NumMatricula = maskedTextBox1->Text;
//paluno->ListaDisciplinas = listBox1->Items->ToString();
//paluno->ndisc = listBox1->Items->Count;
}
};
}

Edição das 17h08min de 21 de março de 2018

Tela Design criada para Form1:

Form1dsg.png

Tela em tempo de execução:

Form1rt.png



Código classe Aluno.h:

#pragma once
using namespace System; //para poder usar classe String^
ref class Aluno
{
public:
   Aluno(void);
   String^ NomeAluno;
   String^ NumMatricula;
   String^ ListaDisciplinas;
   void ImprimeSaida();
   void EntraNotas();
   int ndisc;	
   bool aprovado;	
   float Medias;
private:
   void Calcula_Medias();
};


Código classe Aluno.cpp:

   #include "StdAfx.h"
   #include "Aluno.h"
   Aluno::Aluno(void)
   {
     aprovado = true;
   }
   void Aluno::ImprimeSaida()
   {int i;
   for(i=0;i<ndisc;i++)
      if(Medias < 6)
         aprovado = false;
   }
 void Aluno::Calcula_Medias()
 {
 }
 void Aluno::EntraNotas()
 {
 }


Código Form1.h

#include "CadastraNomes.h"
#include "Aluno.h"  
using namespace std;
#pragma once
namespace RegistroAcademico {

using namespace System; using namespace System::ComponentModel; using namespace System::Collections; using namespace System::Windows::Forms; using namespace System::Data; using namespace System::Drawing; /// <summary> /// Summary for Form1 /// /// WARNING: If you change the name of this class, you will need to change the /// 'Resource File Name' property for the managed resource compiler tool /// associated with all .resx files this class depends on. Otherwise, /// the designers will not be able to interact properly with localized /// resources associated with this form. /// </summary> public ref class Form1 : public System::Windows::Forms::Form { Aluno paluno; //**declaração do objeto aqui - global ao Form!!!! public: Form1(void) { InitializeComponent(); // //TODO: Add the constructor code here // } protected: /// <summary> /// Clean up any resources being used. /// </summary> ~Form1() { if (components) { delete components; } } private: System::Windows::Forms::Button^ button1; private: System::Windows::Forms::Label^ label1; private: System::Windows::Forms::Label^ label2; private: System::Windows::Forms::Label^ label3; private: System::Windows::Forms::Label^ label4; private: System::Windows::Forms::Label^ label5; private: System::Windows::Forms::ListBox^ listBox1; private: System::Windows::Forms::TextBox^ textBox1; private: System::Windows::Forms::MaskedTextBox^ maskedTextBox1; private: System::Windows::Forms::Button^ button2; private: System::Windows::Forms::Label^ label6; private: System::Windows::Forms::Label^ label7; private: System::Windows::Forms::Button^ button3; private: System::Windows::Forms::Panel^ panel1; private: System::Windows::Forms::TextBox^ textBox2; private: System::Windows::Forms::ListBox^ listBox2; private: System::Windows::Forms::MaskedTextBox^ maskedTextBox2; protected: private: /// <summary> /// Required designer variable. /// </summary> System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code

/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> void InitializeComponent(void) { this->button1 = (gcnew System::Windows::Forms::Button()); this->label1 = (gcnew System::Windows::Forms::Label()); this->label2 = (gcnew System::Windows::Forms::Label()); this->label3 = (gcnew System::Windows::Forms::Label()); this->label4 = (gcnew System::Windows::Forms::Label()); this->label5 = (gcnew System::Windows::Forms::Label()); this->listBox1 = (gcnew System::Windows::Forms::ListBox()); this->textBox1 = (gcnew System::Windows::Forms::TextBox()); this->maskedTextBox1 = (gcnew System::Windows::Forms::MaskedTextBox()); this->button2 = (gcnew System::Windows::Forms::Button()); this->label6 = (gcnew System::Windows::Forms::Label()); this->label7 = (gcnew System::Windows::Forms::Label()); this->button3 = (gcnew System::Windows::Forms::Button()); this->panel1 = (gcnew System::Windows::Forms::Panel()); this->textBox2 = (gcnew System::Windows::Forms::TextBox()); this->listBox2 = (gcnew System::Windows::Forms::ListBox()); this->maskedTextBox2 = (gcnew System::Windows::Forms::MaskedTextBox()); this->panel1->SuspendLayout(); this->SuspendLayout(); // // button1 // this->button1->Location = System::Drawing::Point(515, 190); this->button1->Name = L"button1"; this->button1->Size = System::Drawing::Size(120, 63); this->button1->TabIndex = 5; this->button1->Text = L"Entra Notas"; this->button1->UseVisualStyleBackColor = true; this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click); // // label1 // this->label1->AutoSize = true; this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, static_cast<System::Byte>(0))); this->label1->Location = System::Drawing::Point(37, 43); this->label1->Name = L"label1"; this->label1->Size = System::Drawing::Size(55, 20); this->label1->TabIndex = 1; this->label1->Text = L"Nome:"; // // label2 // this->label2->AutoSize = true; this->label2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, static_cast<System::Byte>(0))); this->label2->Location = System::Drawing::Point(37, 81); this->label2->Name = L"label2"; this->label2->Size = System::Drawing::Size(159, 20); this->label2->TabIndex = 2; this->label2->Text = L"Número de Matrícula:"; // // label3 // this->label3->AutoSize = true; this->label3->Enabled = false; this->label3->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, static_cast<System::Byte>(0))); this->label3->Location = System::Drawing::Point(12, 67); this->label3->Name = L"label3"; this->label3->Size = System::Drawing::Size(76, 20); this->label3->TabIndex = 3; this->label3->Text = L"Situação:"; // // label4 // this->label4->AutoSize = true; this->label4->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, static_cast<System::Byte>(0))); this->label4->Location = System::Drawing::Point(37, 123); this->label4->Name = L"label4"; this->label4->Size = System::Drawing::Size(148, 20); this->label4->TabIndex = 4; this->label4->Text = L"Lista de Disciplinas:"; // // label5 // this->label5->AutoSize = true; this->label5->Enabled = false; this->label5->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, static_cast<System::Byte>(0))); this->label5->Location = System::Drawing::Point(3, 15); this->label5->Name = L"label5"; this->label5->Size = System::Drawing::Size(146, 20); this->label5->TabIndex = 5; this->label5->Text = L"Média na disciplina:"; // // listBox1 // this->listBox1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, static_cast<System::Byte>(0))); this->listBox1->FormattingEnabled = true; this->listBox1->ItemHeight = 20; this->listBox1->Location = System::Drawing::Point(41, 183); this->listBox1->Name = L"listBox1"; this->listBox1->Size = System::Drawing::Size(162, 224); this->listBox1->TabIndex = 4; // // textBox1 // this->textBox1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, static_cast<System::Byte>(0))); this->textBox1->Location = System::Drawing::Point(98, 37); this->textBox1->Name = L"textBox1"; this->textBox1->Size = System::Drawing::Size(222, 29); this->textBox1->TabIndex = 0; // // maskedTextBox1 // this->maskedTextBox1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, static_cast<System::Byte>(0))); this->maskedTextBox1->Location = System::Drawing::Point(211, 78); this->maskedTextBox1->Mask = L"000000"; this->maskedTextBox1->Name = L"maskedTextBox1"; this->maskedTextBox1->Size = System::Drawing::Size(74, 29); this->maskedTextBox1->TabIndex = 1; // // button2 // this->button2->Location = System::Drawing::Point(253, 152); this->button2->Name = L"button2"; this->button2->Size = System::Drawing::Size(118, 54); this->button2->TabIndex = 3; this->button2->Text = L"Nova disciplina"; this->button2->UseVisualStyleBackColor = true; this->button2->Click += gcnew System::EventHandler(this, &Form1::button2_Click); // // label6 // this->label6->AutoSize = true; this->label6->Enabled = false; this->label6->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, static_cast<System::Byte>(0))); this->label6->ForeColor = System::Drawing::SystemColors::Desktop; this->label6->Location = System::Drawing::Point(155, 15); this->label6->Name = L"label6"; this->label6->Size = System::Drawing::Size(20, 24); this->label6->TabIndex = 10; this->label6->Text = L"0"; // // label7 // this->label7->AutoSize = true; this->label7->Enabled = false; this->label7->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, static_cast<System::Byte>(0))); this->label7->ForeColor = System::Drawing::SystemColors::Desktop; this->label7->Location = System::Drawing::Point(110, 67); this->label7->Name = L"label7"; this->label7->Size = System::Drawing::Size(25, 24); this->label7->TabIndex = 11; this->label7->Text = L"..."; // // button3 // this->button3->Location = System::Drawing::Point(253, 409); this->button3->Name = L"button3"; this->button3->Size = System::Drawing::Size(113, 96); this->button3->TabIndex = 6; this->button3->Text = L"CADASTRA ALUNO"; this->button3->UseVisualStyleBackColor = true; this->button3->Click += gcnew System::EventHandler(this, &Form1::button3_Click); // // panel1 // this->panel1->Controls->Add(this->label5); this->panel1->Controls->Add(this->label6); this->panel1->Controls->Add(this->label7); this->panel1->Controls->Add(this->label3); this->panel1->Location = System::Drawing::Point(26, 531); this->panel1->Name = L"panel1"; this->panel1->Size = System::Drawing::Size(355, 107); this->panel1->TabIndex = 12; // // textBox2 // this->textBox2->Location = System::Drawing::Point(42, 151); this->textBox2->Name = L"textBox2"; this->textBox2->Size = System::Drawing::Size(160, 20); this->textBox2->TabIndex = 2; // // listBox2 // this->listBox2->FormattingEnabled = true; this->listBox2->Location = System::Drawing::Point(396, 230); this->listBox2->Name = L"listBox2"; this->listBox2->Size = System::Drawing::Size(103, 160); this->listBox2->TabIndex = 13; // // maskedTextBox2 // this->maskedTextBox2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, static_cast<System::Byte>(0))); this->maskedTextBox2->Location = System::Drawing::Point(396, 190); this->maskedTextBox2->Mask = L"90"; this->maskedTextBox2->Name = L"maskedTextBox2"; this->maskedTextBox2->Size = System::Drawing::Size(40, 29); this->maskedTextBox2->TabIndex = 14; this->maskedTextBox2->Text = L"00"; // // Form1 // this->AutoScaleDimensions = System::Drawing::SizeF(6, 13); this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; this->ClientSize = System::Drawing::Size(647, 650); this->Controls->Add(this->maskedTextBox2); this->Controls->Add(this->listBox2); this->Controls->Add(this->textBox2); this->Controls->Add(this->panel1); this->Controls->Add(this->button3); this->Controls->Add(this->button2); this->Controls->Add(this->maskedTextBox1); this->Controls->Add(this->textBox1); this->Controls->Add(this->listBox1); this->Controls->Add(this->label4); this->Controls->Add(this->label2); this->Controls->Add(this->label1); this->Controls->Add(this->button1); this->Name = L"Form1"; this->Text = L"Cadastro de Alunos"; this->panel1->ResumeLayout(false); this->panel1->PerformLayout(); this->ResumeLayout(false); this->PerformLayout(); }

#pragma endregion

private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) { static float soma=0; int n; // if(listBox1->SelectedIndex == 0) // { CadastraNomes^ Form2 = gcnew CadastraNomes; // Form2->Visible = true;

           if(listBox2->Items->Count < 5)

{ label3->Enabled = true;

              label5->Enabled = true;
              label6->Enabled = true;

label7->Enabled = true; listBox2->Items->Add(maskedTextBox2->Text); soma += Convert::ToDouble(maskedTextBox2->Text); n = Convert::ToInt16(listBox2->Items->Count); listBox2->Select(); maskedTextBox2->Clear(); maskedTextBox2->Focus(); } else { MessageBox::Show("Limite máximo de notas por disciplina: 5", "Número Máximo de Notas", MessageBoxButtons::OK, MessageBoxIcon::Error); maskedTextBox2->Clear();

}

           paluno.Medias = soma/n;

label6->Text = Convert::ToString(paluno.Medias); }

private: System::Void button2_Click(System::Object^  sender, System::EventArgs^  e) {

if(listBox1->Items->Count < 10) { listBox1->Items->Add(textBox2->Text); listBox1->Select(); textBox2->Clear(); textBox2->Focus(); } else { MessageBox::Show("Limite máximo de disciplinas por semestre: 10", "Número Máximo de Disciplinas", MessageBoxButtons::OK, MessageBoxIcon::Error); textBox2->Clear();

} listBox1->SelectedIndex = 0; } private: System::Void button3_Click(System::Object^ sender, System::EventArgs^ e) { int i; paluno.NomeAluno = textBox1->Text; paluno.NumMatricula = maskedTextBox1->Text; paluno.ListaDisciplinas = listBox1->Items->ToString(); paluno.ndisc = listBox1->Items->Count; if(paluno.Medias >=6) { paluno.aprovado = true; label7->Text = "Apto"; } else { paluno.aprovado = false; label7->Text = "Não Apto"; } //paluno->NomeAluno = textBox1->Text; //paluno->NumMatricula = maskedTextBox1->Text; //paluno->ListaDisciplinas = listBox1->Items->ToString(); //paluno->ndisc = listBox1->Items->Count; } }; }