Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace pontosztalya
- {
- class pont
- {
- double x, y; //privát adat tagok (default)
- public pont(double a, double b)
- {
- x = a;
- y = b;
- }
- public double aps()
- {
- return x;
- }
- public double ord()
- {
- return y;
- }
- public double tavolsag(pont p)
- {
- double d;
- d=Math.Sqrt(Math.Pow(x-p.x,2)+Math.Pow(y-p.y,2));
- return d;
- }
- public void ir(pont p)
- {
- Console.WriteLine(p.x + "," + p.y);
- }
- }
- class Program
- {
- static void Main(string[] args)
- {
- double x1, x2, y1, y2;
- Console.WriteLine("Az első pont koordinátái: ");
- Console.Write("x1: ");
- x1 = double.Parse(Console.ReadLine());
- Console.Write("y1: ");
- y1 = double.Parse(Console.ReadLine());
- Console.WriteLine("Az masodik pont koordinátái: ");
- Console.Write("x2: ");
- x2 = double.Parse(Console.ReadLine());
- Console.Write("y2: ");
- y2 = double.Parse(Console.ReadLine());
- pont p1 = new pont(x1, y1);
- pont p2 = new pont(x2, y2);
- Console.Write("Az elso pont ");
- Console.WriteLine(+p1.aps()
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement