Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 3

using System.

Text;
using Usluge;

internal class Program


{
private static void Main(string[] args)
{

Console.Write("n?");
int n = int.Parse(Console.ReadLine());
Tacka[] niz = new Tacka[n];
Console.WriteLine("Tacke?");
for (int i = 0; i < n-1; i++)
{
string[] s = Console.ReadLine().Split();
double a = Citaj.Double(), b = Citaj.Double();
niz[i] = new Tacka(a, b);

}
for (int i = 0; i < n-1; i++)
{
for (int j = i + 1; j < n-1; j++)
{
if (niz[i].r() > niz[j].r())
{ Tacka temp = niz[i]; niz[i] = niz[j]; niz[j] = temp; }
}
}
for (int i = 0; i < n-1; i++)
{
Console.Write("(" + niz[i].Da() + "," + niz[i].Db() + ") " );
niz[i].Ispis();
Console.WriteLine();
}
}
}
class Tacka
{
private double a;
private double b;
public Tacka(double a, double b)
{
this.a = a;
this.b = b;
}
public double Da()
{
return a;
}
public double r()
{
return Math.Sqrt(Math.Pow(a, 2) + Math.Pow(a, 2));
}
public double Db()
{
return b;
}
public void Ispis()
{
Console.Write(" r= " + r().ToString(""));
}
}
namespace Usluge
{
internal class Citaj
{
private TextReader ut; // Ulazni tok iz kojeg se cita.

public Citaj(TextReader uut) { ut = uut; } // Inicijalizacija


// ulaznim tokom.
public Citaj(string ime) // Otvaranje datoteke.
{ ut = new StreamReader(ime); }

public bool EndS() // Da li je kraj toka?


{ return ut.Peek() == -1; }

public char GetChS() // Dohvatanje sledeceg znaka.


{ return (char)ut.Read(); }

public char CharS()


{ // Citanje jednog (nebelog) znaka.
char zn = '\0';
while (char.IsWhiteSpace(zn = GetChS())) ;
return zn;
}

public string StringS()


{ // Citanje jedne reèi.
StringBuilder sb = new StringBuilder(CharS().ToString());
int zn = '\0';
while ((zn = ut.Peek()) != -1 && !char.IsWhiteSpace((char)zn))
sb.Append((char)ut.Read());
return sb.ToString();
}

public string LineS() // Citanje jednog reda teksta.


{ return ut.ReadLine(); }

public byte ByteS() // Citanje podatka tipa byte.


{ return byte.Parse(StringS()); }

public sbyte SByteS() // Citanje podatka tipa sbyte.


{ return sbyte.Parse(StringS()); }

public short ShortS() // Citanje podatka tipa short.


{ return short.Parse(StringS()); }

public ushort UShortS() // Citanje podatka tipa ushort.


{ return ushort.Parse(StringS()); }

public int IntS() // Citanje podatka tipa int.


{ return int.Parse(StringS()); }

public uint UIntS() // Citanje podatka tipa uint.


{ return uint.Parse(StringS()); }

public long LongS() // Citanje podatka tipa long.


{ return long.Parse(StringS()); }
public ulong ULongS() // Citanje podatka tipa ulong.
{ return ulong.Parse(StringS()); }

public float FloatS() // Citanje podatka tipa float.


{ return float.Parse(StringS()); }

public double DoubleS() // Citanje podatka tipa double.


{ return double.Parse(StringS()); }

public decimal DecimalS() // Citanje podatka tipa decimal.


{ return decimal.Parse(StringS()); }

// PODRŠKA ZA CITANJE SA STANDARDOG ULAZA.

private static Citaj gl = new Citaj(Console.In); // Predstavnik standardog


// ulaza.
public static bool End() { return gl.EndS(); } // Varijante metoda
public static char GetCh() { return gl.GetChS(); } // koje citaju sa
public static char Char() { return gl.CharS(); } // standardog ulaza,
public static string String() { return gl.StringS(); }
public static string Line() { return gl.LineS(); }
public static byte Byte() { return gl.ByteS(); }
public static sbyte SByte() { return gl.SByteS(); }
public static short Short() { return gl.ShortS(); }
public static ushort UShort() { return gl.UShortS(); }
public static int Int() { return gl.IntS(); }
public static uint UInt() { return gl.UIntS(); }
public static long Long() { return gl.LongS(); }
public static ulong ULong() { return gl.ULongS(); }
public static float Float() { return gl.FloatS(); }
public static double Double() { return gl.DoubleS(); }
public static decimal Decimal() { return gl.DecimalS(); }
}
}

You might also like