Danielos168

Zadanie1 26-02

Feb 26th, 2019
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.23 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Zadanie1
  8. {
  9.     class Punkt
  10.     {
  11.         public double wspolrzedna_x;
  12.         public double wspolrzedna_y;
  13.         public double wspolrzedna_z;
  14.  
  15.         public Punkt(double x,double y, double z)
  16.         {
  17.             wspolrzedna_x = x;
  18.             wspolrzedna_y = y;
  19.             wspolrzedna_z = z;
  20.         }
  21.         public void Wyswietl()
  22.         {
  23.             Console.WriteLine("Punkt x: {0}", wspolrzedna_x);
  24.             Console.WriteLine("Punkt y: {0}", wspolrzedna_y);
  25.             Console.WriteLine("Punkt z: {0}", wspolrzedna_z);
  26.             Console.WriteLine();
  27.             Console.WriteLine();
  28.         }
  29.         public void zmien(double nowa_x,double nowa_y, double nowa_z)
  30.         {
  31.             wspolrzedna_x += nowa_x;
  32.             wspolrzedna_y += nowa_y;
  33.             wspolrzedna_z += nowa_z;
  34.         }
  35.     }
  36.     class Program
  37.     {
  38.         static void Main(string[] args)
  39.         {
  40.             Punkt p1 = new Punkt(5, 10, 15);
  41.             p1.Wyswietl();
  42.             p1.zmien(5, 10, 15);
  43.             p1.Wyswietl();
  44.            
  45.             Console.ReadKey();
  46.         }
  47.     }  
  48. }
Add Comment
Please, Sign In to add comment