0% found this document useful (0 votes)
14 views

definimos El Vector: Form1 Form

The document defines a Windows Forms application that allows a user to enter student exam scores. It initializes variables to track the total score, number of scores entered, and average. Scores are added to an array as the user enters them. If 10 scores are reached, the program calculates how many scores were above and below the average and displays the results. Buttons allow clearing the displayed data and closing the application.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

definimos El Vector: Form1 Form

The document defines a Windows Forms application that allows a user to enter student exam scores. It initializes variables to track the total score, number of scores entered, and average. Scores are added to an array as the user enters them. If 10 scores are reached, the program calculates how many scores were above and below the average and displays the results. Buttons allow clearing the displayed data and closing the application.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

using System;

using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public static double calmay = 0;
public static double calmen = 0;
public static double sumcal = 0;
public static double prom;
//definimos el vector
public static double[] cali = new double[100];
int dato = 0;
int i;

public Form1()
{
InitializeComponent();
}

private void label1_Click(object sender, EventArgs e)


{

private void Form1_Load(object sender, EventArgs e)


{

private void textBox1_KeyPress(object sender, KeyPressEventArgs


e)
{
if (e.KeyChar == (char)13)
{
dato++;
cali[dato] = double.Parse(tcalificacion.Text);

//introducimos al data grive

object[] fila = { dato.ToString(),


cali[dato].ToString() };
calificaciones.Rows.Add(fila);
sumcal=sumcal+cali[dato];
tcalificacion.Text = "";
tcalificacion.Focus();
}
prom=sumcal/dato;
if (dato == 10)
{
DialogResult opcion;
opcion = MessageBox.Show("no se puede ingresar mas
datos", "mensaje de informacion", MessageBoxButtons.YesNo,
MessageBoxIcon.Question);
if (opcion == DialogResult.Yes)
{
for (i = 1; i <= dato; i++)
{
if (cali[i] > prom)
calmay++;
else if (cali[i] < prom)
calmen++;
}

//asignamos los valores a la caja de datos

tpromedio.Text = prom.ToString();
tcalmay.Text = calmay.ToString();
tcalmen.Text = calmen.ToString();
}

private void limpiar_Click(object sender, EventArgs e)


{
tcalificacion.Text = "";
tpromedio.Text = "";
tcalmay.Text = "";
tcalmen.Text = "";
calificaciones.Rows.Clear();

private void salir_Click(object sender, EventArgs e)


{
this.Close();

}
}
}

You might also like