jueves, 13 de junio de 2013

APLICACION CON VALORES ANGULARES

En esta aplicacion muestra el uso de los arreglos de dos dimensiones. Este programa convierte los numeros de 15 en 15 en valores ngulares como seno coseno y tangente.

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 grados_a_sen_cos_tan_etc
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            dataGridView1.RowCount = 24;
            dataGridView1.ColumnCount = 11;
        }

        private void butMostrar_Click(object sender, EventArgs e)
        {
            double gra = 15;
            double angulo = 0;


            //AGREGAR LOS GRADOS EN EL DATAGRIDVIEW
            for (int ren = 0; ren < dataGridView1.RowCount; ren++)
            {
                dataGridView1[0, ren].Value = gra;
                gra = gra + 15;
            }

            //radines
            for (int ren = 0; ren < dataGridView1.RowCount; ren++)
            {
                angulo = (gra * Math.PI / 180);
                dataGridView1[1, ren].Value = angulo;
                //dataGridView1[1, ren].Value = angulo.ToString("##.####");
                gra = gra + 15;
            }


            //seno
            for (int ren = 0; ren < dataGridView1.RowCount; ren++)
            {
                angulo = Math.Sin(gra * Math.PI / 180);
                dataGridView1[2, ren].Value = angulo;
                //dataGridView1[2, ren].Value = angulo.ToString("##.####");
                gra = gra + 15;
            }


            //coseno
            for (int ren = 0; ren < dataGridView1.RowCount; ren++)
            {
                angulo = Math.Cos((gra * Math.PI) / 180);
                dataGridView1[3, ren].Value = angulo;
                //dataGridView1[3, ren].Value = angulo.ToString("##.####");
                gra = gra + 15;
            }

            //tangente
            for (int ren = 0; ren < dataGridView1.RowCount; ren++)
            {
                angulo = Math.Tan((gra * Math.PI) / 180);
                dataGridView1[4, ren].Value = angulo;
                //dataGridView1[4, ren].Value = angulo.ToString("##.####");
                gra = gra + 15;
            }
}


No hay comentarios:

Publicar un comentario