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 punkt
- {
- class Punkt
- {
- int wspolrzednaX, wspolrzednaY;
- public Punkt(int x, int y)
- {
- wspolrzednaX = x;
- wspolrzednaY = y;
- }
- public void Przesuń(int ox, int oy)
- {
- wspolrzednaX += ox;
- wspolrzednaY += oy;
- Console.WriteLine("Przesunięto!");
- }
- public void Wyświetl()
- {
- Console.WriteLine("\nPunkt jest na wspolrzednych X:{0} Y:{1}", wspolrzednaX, wspolrzednaY);
- }
- }
- class Program
- {
- static void Main(string[] args)
- {
- int x, y, ox, oy;
- Console.Write("Podaj wspolrzedna X: ");
- x = Int32.Parse(Console.ReadLine());
- Console.Write("Podaj wspolrzedna Y: ");
- y = Int32.Parse(Console.ReadLine());
- Punkt p1 = new Punkt(x,y);
- p1.Wyświetl();
- Console.Write("\nPrzesuń na X: ");
- ox = Int32.Parse(Console.ReadLine());
- Console.Write("Przesuń na Y: ");
- oy = Int32.Parse(Console.ReadLine());
- p1.Przesuń(ox, oy);
- p1.Wyświetl();
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement