N
N
NikaBestyjeva2020-02-16 00:38:31
C++ / C#
NikaBestyjeva, 2020-02-16 00:38:31

What is wrong with the format changed to others the same error when entering these numbers swears on the 25th line?

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

namespace WindowsFormsApp2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            {
                double x, y, z, a, b, q;
                 a = Convert.ToDouble(textBox1.Text);
                b = Convert.ToSByte(textBox2.Text);
                q = Convert.ToSByte(textBox3.Text);
                x = Convert.ToSByte(textBox4.Text);
                y = Convert.ToDouble(textBox5.Text);
                
                z =( Math.Sqrt((a + Math.Cos(x) * Math.Log10(q)) / (b + y * Math.Sin(x))));

                listBox1.Items.Add(" При a=" + a);
                listBox1.Items.Add("     b=" + b);
                listBox1.Items.Add("     q=" + q);
                listBox1.Items.Add("     x=" + x);
                listBox1.Items.Add("     y=" + y);
                listBox1.Items.Add("z= " + z);
            }



        }

        private void button2_Click(object sender, EventArgs e)
        
            { Application.Exit();
        }
        }
    }

5e4864cc9fb5f174247841.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
freeExec, 2020-02-16
@freeExec

Cosines and sines expect an argument in radians, and you probably give it degrees.
P.S. Naturally, I did not consider where you have line 25 there, and what kind of mistake you have. But the elixir of telepathy makes itself felt.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question