gliga2000
Obećava
- Poruka
- 53
Hvala, hteo bih to u primerima!
Donji video pokazuje kako da instalirate aplikaciju na početni ekran svog uređaja.
Napomena: This feature may not be available in some browsers.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace pomoc_krsta
{
class Program
{
static void Main(string[] args)
{
int operand1, operand2;
Console.Write("Upisite vrednost za operand1: ");
operand1 = int.Parse(Console.ReadLine());
Console.Write("Upisite vrednost za operand2: ");
operand2 = int.Parse(Console.ReadLine());
Kalkulator k = new Kalkulator(operand1, operand2);
k.Ispisi();
Console.WriteLine("--------------------");
Console.WriteLine("operand1+operand2="+k.Sabiranje());
Console.WriteLine("operand1-operand2="+k.Oduzimanje());
Console.WriteLine("operand1*operand2="+k.Mnozenje());
Console.WriteLine("operand1/operand2="+k.Deljenje());
Console.WriteLine("--------------------");
Console.WriteLine("Povrsina je: " + k.Povrsina());
Console.ReadKey();
}
}
class Kalkulator
{
private const float PI = 3.14f;
private int operand1, operand2; //this
public Kalkulator(int operand1, int operand2)
{
this.operand1 = operand1;
this.operand2 = operand2;
}
public void Ispisi()
{
Console.WriteLine("Operand1: "+operand1);
Console.WriteLine("Operand2: "+operand2);
}
public float Sabiranje()
{
return operand1 + operand2;
}
public float Oduzimanje()
{
return operand1 - operand2;
}
public float Mnozenje()
{
return operand1 * operand2;
}
public float Deljenje()
{
return operand1 / operand2;
}
public static float Sabiranje(int operand1, int operand2)
{
return operand1 + operand2;
}
public static float Oduzimanje(int operand1, int operand2)
{
return operand1 - operand2;
}
public static float Mnozenje(int operand1, int operand2)
{
return operand1 * operand2;
}
public static float Deljenje(int operand1, int operand2)
{
return operand1 / operand2;
}
public float Povrsina()
{
float P = 2 * PI * operand1;
return P;
}
}
}
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)Keys.Return)
{
e.Handled = true;
textBox2.Focus();
}
}
private void textBox2_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)Keys.Return)
{
e.Handled = true;
textBox1.Focus();
}
}