NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

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 hesapmakinesi
/*
Hesap Makinası:
Donanım klavye ile de kullanılsın
1) Tek girdili Hesaplamalar:
sin(x), cos(x), tanx(x), atan(x), sqr(x),sqrt(x),
1/x tıklandığında :x değeri txtbx dan al ve sonucu
hesapla, sonucu txtbx1 yaz aksi durumda hata ver
2) iki girdi alan hesaplamalar:x+y, x/y, x-y, x^y
+,-,*,/, ^ tıklandı ise x değerini txtbx dan al,
islemi al ,x değerini ve işlemi label1 e yaz.
= tıklandıysa y değerini txtbx den al , x ve y
hatasız alındıysa işlemi uygula, sonucu hesapla
işlemi label'a, sonucu txtbx'a yaz, aksi durumda
hata ver.
*/
{
public partial class Form1 : Form
{
//Field/alan : form1 sınıfının değişken ve nesneleri
double x, y, sonuc;
char islem;

public Form1()
{
InitializeComponent();
}

private void textBox1_TextChanged(object sender, EventArgs e)
{

}



private void panel1_Paint(object sender, PaintEventArgs e)
{
//panel ekrana çizilirken...
}



private void Form1_Load(object sender, EventArgs e)
{
this.Text = "Hesap Makinası";
}


#region Tek Değer Alan İşlemler
private void button5_Click(object sender, EventArgs e)
{// 1/x hesapla
x=Convert.ToDouble(textBox1.Text);
islem = 'T';
label1.Text = "1/x" +x.ToString()+"=";
sonuc = 1.0 / x;
textBox1.Text = sonuc.ToString();
}

private void button6_Click(object sender, EventArgs e)
{//x2 hesapla
x = double.Parse(textBox1.Text);
islem = 'K';
label1.Text = x.ToString() +islem +"=";
sonuc = x * x;
textBox1.Text = sonuc.ToString();
}

private void button9_Click(object sender, EventArgs e)
{//sin(x)
x=double.Parse(textBox1.Text);
islem = 's';
//x dereceyi radyana çevirelim
sonuc = Math.Sin(Math.PI*x/180.0);
label1.Text = "Sin(" + x.ToString() + ")=";
textBox1.Text=sonuc.ToString();
}

private void button10_Click(object sender, EventArgs e)
{
//COS(x)
x = double.Parse(textBox1.Text);
islem = 'c';
//x dereceyi radyana çevirelim
sonuc = Math.Cos(Math.PI * x / 180.0);
label1.Text = "Cos(" + x.ToString() + ")=";
textBox1.Text = sonuc.ToString();
}

private void button11_Click(object sender, EventArgs e)
{
x= double.Parse(textBox1.Text);
islem = 't';// derece-> radyan
sonuc = Math.Tan(Math.PI * x / 180.0);
label1.Text = "Tan(" + x.ToString() + ")=";
textBox1.Text = sonuc.ToString();
}

private void button7_Click_1(object sender, EventArgs e)
{// square root: karekök
x = Convert.ToDouble(textBox1.Text);
islem = '√';
label1.Text = islem.ToString() + x.ToString();
sonuc = Math.Sqrt(x);
textBox1.Text = sonuc.ToString();

}

private void button12_Click(object sender, EventArgs e)
{
x = double.Parse(textBox1.Text);
islem = 'a';
//açı= atan(eğim:karşı/komşu)
sonuc = 180.0*Math.Atan(x)/Math.PI;
label1.Text = "Arctan(" + x.ToString() + ")=";
textBox1.Text = sonuc.ToString();
}



#endregion

#region İki Değer Alan İşlemler
private void button1_Click(object sender, EventArgs e)
{//+
islem = '+';
x = Convert.ToDouble(textBox1.Text);
label1.Text = x.ToString() + islem;
textBox1.Text = "";//Metin kutusunu temizle
textBox1.Focus();//imleci metin kutusuna getir
}

private void button2_Click(object sender, EventArgs e)
{// -
islem= '-';
x=Convert.ToDouble(textBox1.Text);
label1.Text = textBox1.Text + islem;
textBox1.Text = "";
textBox1.Focus();
}

private void button3_Click(object sender, EventArgs e)
{//x
islem = 'x';
x= Convert.ToDouble(textBox1.Text);
label1.Text=x.ToString() + islem;
textBox1.Clear();
textBox1.Focus();
}


private void button4_Click(object sender, EventArgs e)
{// /
islem = '/';
x= Convert.ToDouble(textBox1.Text);
label1.Text = x.ToString() + islem;
textBox1.Clear();
textBox1.Focus();
}


private void button8_Click(object sender, EventArgs e)
{//x^y
islem = '^';
x = Convert.ToDouble(textBox1.Text);
label1.Text = x.ToString() + islem;
textBox1.Clear();
textBox1.Focus();
}

private void button25_Click(object sender, EventArgs e)
{// = basıldı, y al, işlemi yap sonucu bas
sonuc = 0.0;
y = Convert.ToDouble(textBox1.Text);
if (islem == '+')
sonuc = x + y;

else if (islem == '-')
sonuc = x - y;

else if (islem == 'x')
sonuc = x * y;

else if (islem == '/')
sonuc = x / y;
else if (islem=='^')
sonuc = Math.Pow(x,y);
else
{
throw new Exception("31");
}
label1.Text += y.ToString() + "=" + sonuc.ToString();
textBox1.Text = sonuc.ToString();
}

#endregion

#region Yardımcı Fonksiyonlar
private void button13_Click(object sender, EventArgs e)
{
textBox1.Text += "1";
}

private void button14_Click(object sender, EventArgs e)
{
textBox1.Text += "2";
}

private void button15_Click(object sender, EventArgs e)
{
textBox1.Text += "3";
}

private void button16_Click(object sender, EventArgs e)
{
textBox1.Text += "4";
}

private void button17_Click(object sender, EventArgs e)
{
textBox1.Text += "5";
}

private void button18_Click(object sender, EventArgs e)
{
textBox1.Text += "6";
}

private void button19_Click(object sender, EventArgs e)
{
textBox1.Text += "7";
}

private void button20_Click(object sender, EventArgs e)
{
textBox1.Text += "8";
}

private void button21_Click(object sender, EventArgs e)
{
textBox1.Text += "9";
}

private void button22_Click(object sender, EventArgs e)
{
textBox1.Text += ",";
}


private void button23_Click(object sender, EventArgs e)
{
textBox1.Text += "0";
}



private void button24_Click(object sender, EventArgs e)
{
textBox1.Clear();
}

//Metin kutusuna tıklayınca içi silinsin
private void textBox1_Click(object sender, EventArgs e)
{
textBox1.Clear();
}


private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
char tus=e.KeyChar;
if (tus=='+')
{
button1_Click(new object(), new EventArgs());
e.Handled = true;//olay işlendi
}
else if (tus=='-')
{
button2_Click(new object(), new EventArgs());
e.Handled = true;//olay işlendi
}
else if (tus == '*' || tus=='x')
{
button3_Click(new object(), new EventArgs());
e.Handled = true;//olay işlendi
}
else if (tus=='-')
{
button2_Click(new object(), new EventArgs());
e.Handled = true;//olay işlendi
}
else if (tus ==(char)13)
{
button25_Click(new object(), new EventArgs());
e.Handled = true;
}
}



#endregion



}
}
     
 
what is notes.io
 

Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 14 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.